1 of 14

An Amazing Maze Game

Add Variables (Advanced)

2 of 14

3 of 14

Make a Variable

  1. Click on the “Variables” block type and select “Make a Variable”

4 of 14

Name the variable

  • Our first variable will keep track of the number of restarts we’ve had, so name it something like “Restarts”
  • Click OK

5 of 14

Add some new blocks

  • Set our number of Restarts to 0 when the green flag is clicked and show the variable so we can see it
  • Change our Restarts by 1 each time the player touches a wall and restarts
  • Why aren’t we putting another change Restart block in the code when we touch the goal?

6 of 14

Position the display

  • Drag the display into a position that doesn’t block the maze too much

7 of 14

Create another variable

  • We’re going to create a second variable that displays what level we are on
    1. Name it something like “Level”

8 of 14

Add a pair of blocks

  • Inside our Restart function (or message), add a “set Level” block with a “backdrop name” block inside
  • This will make it so it refreshes the backdrop name every time the sprite restarts

9 of 14

All our powers combined - no player controls

  • With the newly added blocks, our code might look something like this

10 of 14

All our powers combined - with player controls

  • With the newly added blocks, our code might look something like this

11 of 14

Make the display larger

  • Right click the variable on the project screen and select “large readout” to make the display bigger

12 of 14

Ooh fancy

  • Now we have two variables on display
    • One displays the backdrop name so we know what level we are on
    • The other displays how many times a player touches a wall and restarts
  • What other variables could we keep track of?
  • Could you make it so it displays how long it takes to clear a level?

13 of 14

Use the tutorial button for more ideas and tips

14 of 14