# Stop game

**URL:** https://forum.kirupa.com/t/stop-game/14602
**Category:** Uncategorized
**Created:** [February 28, 2003, 5:59am UTC](https://forum.kirupa.com/t/stop-game/14602 "2003-02-28T05:59:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fried](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@fried](https://forum.kirupa.com/u/fried)
#### Post date: [February 28, 2003, 5:59am UTC](https://forum.kirupa.com/t/stop-game/14602/1 "2003-02-28T05:59:06Z")

</div>

I have posted this question befor but was asked to be more specific, so here goes.I have made a little cricket game wher the fielder has to catch the ball.There are three different game speeds,slow, medium and fast. I keep score using a dynamic text box and use the code \_root.total = \_root.total+1.When the scor reaches 15 I need the game to go to the next speed level.How will I do this?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 28, 2003, 6:11am UTC](https://forum.kirupa.com/t/stop-game/14602/2 "2003-02-28T06:11:03Z")

</div>

```php
total = 0
function addScore() {
   total++;
   if (total>= 15){
      //change speed code goes here
}
}

```

Add that to a keyframe in the main timeline, then instead of doing \_root.total = \_root.total+1 just do \_root.addScore() it will run the function as shown above. What that function does is takes the variable total, and increments it by 1 (equvilent of \_root.total = \_root.total+1). Then it checks if total is greater or equal to 15, and if it is, it does whatever you tell it to do in there.
