About Maze Game:

Maze Game in Scratch, you will create a game that lets the player guide a cat through a maze to reach its goal—a delicious apple! You’ll learn how to move the cat with the keyboard and how to block its progress with walls.

Choose a sprite to move through a maze. It must fit inside your maze.

Position the Cat Sprite on your screen at the beginning of the maze. Get the values for the x and y coordinates of the Sprite at the beginning of the maze. Set your script to this value.

Maze Scratch game Code

Maze game on Scratch 3.0

Make the cat walk around using arrow keys

When the right arrow key is pressed we can point the Sprite in a certain direction and move ten steps. 

Program your sprite to move in the corresponding direction (left, up, and down) when the arrow keys on the keyboard are pressed

Keep the cat from walking through walls

The problem at the moment is that you can walk through walls. You need to stop when the Maze wall is touched. 

We need to program that, If it is touching a wall, we want it to say “Ahhh” for a period of time, then it goes backwards which makes it look like it has bounced off the wall.

This sensing block tests to see if our Giga sprite is touching any black lines, using the touching colour sensor and if this test is true, then we take back the previous steps. This will stop Giga from crossing the black line.

Add sounds when it hits the maze and when it finishes.

Add a timer and show the time it took to complete the maze once it is successfully completed.

Make a Goal at the end of a Maze

Let’s add an apple at the other end of the maze to make the player’s goal more obvious.

Choose Apple sprite from library and Resize the apple to fit the maze. Now it just needs the code to detect when the player reaches the end. When that happens, you’ll have Scratch play a sound and then swap costumes to the next level. 

Download Project Files:

To download the project files of the project How to Make Maze Game in Scratch Click here. Also go through the another ineresting scratch 3.0 project of Animate Your Name using scratch 3.0 here,