🏠
Section 1.

Danger Zone

Let's add some danger to the game.
Here are the steps:

  1. If any part of platform 1 or platform 2 is at the bottom of the stage, move it somewhere else.
  2. Create a new sprite. Call it Danger Zone. It's very simple to paint: it's just a rectangle at the bottom of the stage.
  3. Fill it with any colour you like. Except not the same colour as your platforms!
Section 2.

Danger Zone

In your main sprite's code tab,
add the code in the picture.

You will need to set the x and y positions so that they are right for your game.

Add your new block to the bottom of your main loop, underneath 'jump'.

Try the game out!

Section 3.

Lives

We can make the game harder, by limiting how many times you can fall into the danger zone.

We do this by adding a new variable called 'lives'.
We set this to 3 when you start the game.
Each time you fall into the danger zone you lose a life.
When there are no more lives left, the game ends.

  1. Declare a new variable, for this sprite, called lives.
  2. In the setup block set it to 3.
  3. Add code to the 'danger' block to change the lives variable by -1.
    If it gets to zero we call a new block: 'end game'.
  4. For now, the 'end game' block just says that there are no lives left.
    Then it ends the game.
    Later on, this block will do more things.

🏠