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

LineWhat it does
when any {Heroes} jumpsThis rule runs each time the hero jumps
@jumps goes up by 1Adds 1 to the box called jumps
show "Jumps: @jumps" for 1 secondPuts the number on the screen for a second

The box starts empty, which counts as 0. The first jump makes it 1.

Try it

  1. Press Play Play this script, under the little game.
  2. Click the little game, so the keys work.
  3. 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.

  1. Press Stop Stop.
  2. Press Blocks Blocks, at the top left of the code box. There you can type any number.
  3. In the goes up by block, change 1 to 2.
  4. Press Play Play this script and jump five times.
JumpsCounting by 1Counting by 2
112
224
336
448
5510

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 Play this script.

Press Play in the code box to finish this section.