Recommended for a Year 5 class. Access the original game here.

Teach your year 5 class how to make a maze game using coding blocks and achieve the learning outcomes for Digital Technologies. It’s fun to play and even more fun to build.

The aim of this maze game is to get the monkey through the maze to the banana without touching the purple walls. If the monkey accidentally touches the wall, the game will restart. When the monkey reaches the banana, “You Win!” is displayed and cheering sounds play.

Learning outcomes

This maze game project includes these Digital Technologies learning outcomes:

  • Design, modify and follow simple algorithms involving sequences of steps, branching, and iteration (repetition) (ACTDIP019)
  • Design a user interface for a digital system (ACTDIP018)
  • Define problems in terms of data and functional requirements drawing on previously solved problems (ACTDIP017)
  • Implement digital solutions as simple visual programs involving branching, iteration (repetition), and user input (ACTDIP020)

Build the game

To start coding this maze game, create a new file in Scratch by pressing the “Create” button and delete the cat that appears on the page by default. Give the game a title so you can easily find it later.

This game can be broken down into a number of steps.

  1. Maze Drawing
  2. Monkey
  3. Banana

Maze

Firstly, edit the backdrop to resemble a maze. This can be done by clicking the “stage” button on the bottom right corner then going to the “backdrops” tab as shown in the image below. To draw the maze, use a colour such as purple. To draw straight lines, click where you would like to begin the line and then hold the “shift” key on the keyboard and drag the mouse until where you would like to end the line.

Monkey

Once you have completed drawing the maze, move on to create a monkey sprite. To create a sprite, press the button shown in the image below. For this tutorial we will use the monkey sprite, however you are free to use any sprite for your maze.

Now we need to code the monkey to be able to move when the keys are pressed. To do this, use the “Change x/y by” and “When key pressed” blocks shown in the image below from the “Events” and “Motion sections.

Animation

If your sprite has more than one costume, you can add animations to the player. To do this, use the “Next Costume” block from the “Looks” section and place them under every block of movement code.

Collision with Maze

To code the game to restart when the monkey hits the maze, start with a “When green flag clicked” block found in the “Events” section. To make the monkey start at the start of the maze every time, use the “Go to X:, Y:” block found in motions and specify the X and Y coordinates you would like the monkey to start at. The code has to constantly check throughout the game whether the monkey has touched the maze. This is done through using the “Forever” block found in “Control”. Then, use an “If loop” found in “Control” with the condition as “Touching colour ?” which is found in the “Sensing” section.

Banana

Add a banana sprite and place it on the stage at the exit. When the monkey collides with the bananas, “You Win” is displayed and clapping sounds play. To code this, use an “If” statement with the condition as “Touching Mouse Pointer” block. Click on the touching mouse pointer box and select “Bananas” instead of mouse pointer on the drop down menu. Find the block “say ___ for 2 secs” in the “Looks” section and place it inside the if loop. Then, go to the “Sound” section and find the “Play sound ____ until done”. Choose the clapping sound from the drop down menu.

 

You have now completed the maze game! We chose to use these sprites and colours however you are free to be as creative as you want! If you have any questions about this tutorial or any suggestions for future tutorials leave a comment down below!

Happy Scratching!

 

If you’re interested to find out more