<<<
<<<
26
Did the Frog Die?
Now that we have some holes and dragons, we need to think
about what happens when the frog falls down a hole or runs
into a dragon. Open dragons7.sb2 in Scratch. If you run the
game, you will see that the frog dies if he walks into a hole or
bumps into a dragon.
PROJECT PAGE:
Ending the game
If the frog dies, we need a way of stopping the game. We do this by
creating a new variable called “GameOn.” Look for it near the top of
the right-hand long piece of code.
1
You will see that we initially set this variable
to 1, when the green flag is clicked.
We then add an IF statement to the main loop.
This means that we will only move the frog
IF the variable “GameOn” is set to 1.
2
To check whether the frog
has died, we use two more
IF statements, run after any
movement by the frog, like this: