arrow_back Speed Up the Chase
Up for a challenge? In this screencast, you’ll learn how to make this game become more difficult the longer the player plays, then you’ll get to try the programming on your own.
To begin, select one of the chaser sprites.
Remember when you programmed a timer to keep score in this game? The timer is a variable.
When the game starts, the timer is set to to 0. Each second the player plays the game, the value of the timer goes up by one. So, after playing the game for 10 seconds, the value of the timer equals 10.
You can also create programming that makes the timer control the chaser sprite’s speed.
Place the timer inside the “move 10 steps” block.
The "move" block now controls the value of the timer.
When the timer equals 0, the sprite moves 0 steps each time the loop is run.
When the timer equals 5, the sprite moves 5 steps each time the loop is run.
If you put the timer variable inside each chaser’s “move” block, you can see that the game starts slowly, and increases in speed as play continues.
Once the time reaches 10 seconds, and the sprites are moving 10 steps each time the loop runs, the game gets really hard.
If you want to extend the game play, you can use a division operator with the timer, which will only move the sprites a fraction of the time.
For example, if you use “timer / 2,” after ten seconds, the sprite will only move 10 divided by 2, or 5 steps, each time the loop is run.
Ask a neighbor to play your game and see if they think it’s too easy or too hard--or just right!