Count the jumps
Try itKeeping count
Here is your first script with a variable. It counts how many times the hero jumps.
How to read it
| Line | What it does |
|---|---|
when any {Heroes} jumps | This rule runs each time the hero jumps |
@jumps goes up by 1 | Adds 1 to the box called jumps |
show "Jumps: @jumps" for 1 second | Puts the number on the screen for a second |
The box starts empty, which counts as 0. The first jump makes it 1.
Try it
- Press Play
, under the little game. - Click the little game, so the keys work.
- Press Space to jump. Do it five times.
The number goes up by 1 with each jump.
Change the count
Make each jump count for 2.
- Press Stop
. - Press Blocks
, at the top left of the code box. There you can type any number. - In the goes up by block, change 1 to 2.
- Press Play
and jump five times.
| Jumps | Counting by 1 | Counting by 2 |
|---|---|---|
| 1 | 1 | 2 |
| 2 | 2 | 4 |
| 3 | 3 | 6 |
| 4 | 4 | 8 |
| 5 | 5 | 10 |
The second column is the 2 times table. A script that counts by 2 is doing your times table for you.
This section ticks itself when you press Play
.

