+21622886281
Game Scratch

Maze game with Scratch

Description of the game Maze with Scratch

This is a maze game, so the goal is to reach the final position at the top of the screen. To do this, move the cat sprite using the keyboard arrows. But be careful, you must not touch the walls of the labyrinth!

To program this game, we will use the Scratch software which has the advantage of using visual code: no need to learn a programming language. programming to build games.

Step 1: Draw the mazes

Access the site http://www.mazegenerator.net/ to automatically generate the maze.

Step 2: Add the background

1) Go to import a background to add the image of the generated mazes.

2) We get a background that contains mazes:

Step 3: Initialize the game

The game starts when the green flag is clicked to place the cat sprite at the start of the maze.

Step 3: move the cat sprite

We insert the blocks necessary to move the cat sprite via the keyboard arrows:

When the right arrow is pressed the cat sprite should orient and move right.

When the left arrow is pressed the cat sprite should orient and move left.

When the up arrow is pressed the cat sprite should orient and move up.

When the down arrow is pressed the cat sprite should orient and move down.

Step 4: Forbid the cat to cross the walls:

To prevent the cat from crossing the maze walls, one must use the block from the Sensors category which checks if the cat is touching the wall color.

To punish the player for touching a wall, the cat is placed in the initial position.

To check if the cat is touching the wall, we must use the If then else block.

If the condition (the black color is touched is true), the cat is placed in the initial position. And if the condition is false, the cat continues on its way.

Here is the final scratch program of the Labyrinth game:

Download maze game



0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top