Jumping Game

Make a character jump over moving obstacles.

Make a character jump

  • Choose Backdrop 'Blue Sky'.
  • Choose a character like 'Chick' (delete cat).

When the player hits the Space Bar, have the chick go up and then back down (negative number)

Go to start

Set the starting point for your sprite.

  1. Drag your character to where you want it to start on the left.
    When you move your character, its x and y position will update un the blocks palette.
  2. Now when you drag out a go to block, it will set to your character's new position.
  3. Add it to a Flag event.

Moving obstacle

Make an obstacle move across the Stage. First choose a sprite such as 'Egg'.

  1. Move it to the right edge of the stage
  2. Drag out a go to x block with that position.
  3. Drag the egg to the left edge of the Stage.
  4. Drag out a glide 1 sec to block for that position.
  5. Change glide to 3 seconds (smaller number = faster)

Put these blocks inside a forever loop in a Flag event.

Add a sound

Play a sound when your sprite jumps. Go into your chick sprite and add a start sound block just after Space key pressed

Stop the game

Stop the game if the sprite touches the egg.

  • Go into your egg sprite.
  • If you go into Costumes, you can see the sprite's different looks and you'll notice that the second one 'egg-b' is the broken egg.

We need to make sure that the first costume is the default, and when the chick is touching the egg, then it switches costumes to the broken one and the game ends. Do this in a new Flag event.

  1. Add a new Flag event
  2. First switch costumes to 'egg-a' (the default)
  3. Control >> wait until
  4. Sensing >> touching (use drop-down menu to select 'Chick')
  5. Control >> stop all

Add more obstacles

Make the game harder by adding more obstacles.

  1. Duplicate the egg sprite: right-click on the thumbnail and choose duplicate.
  2. Click to select egg2

Add these blocks to wait before showing the second egg.

Score

Add a point each time your sprite jumps over an egg.

  • Variables >> Make a Variable
  • name it 'Score' and then click OK. You'll see it show up.

Go into the Chick sprite and add to the Flag event - make sure the game always starts with a score of 0.


In the Space event, add a change score so it goes up by one point when the chick jumps.