Scratch game making tutorial 71

Pacman maze

In this tutorial you will create a game in which Pacman must move through a maze, avoid enemies, collect hearts, and reach the objective.

 

1. Create a new game file.

2. Delete the cat sprite.

3. Open the "Paint new sprite" window, and zoom out using the zoom tool ..

Create a start/instructions screen like this ..

Click "OK" and name this sprite "Start screen".

Add these scripts ..

 

5. Create these variables "for all sprites" ..

 

6. Edit the stage background to create a maze of paths. Use the 3rd biggest brush size and the line tool ..

.. OR download this image ..

maze-background.gif

7. Add these scripts to the stage ..

 

8. Save your game. Name it "Pacman maze".

 

9. Create a Pacman sprite like this and rename it "Pacman" ..

 

Add this scripts to it ..

You will need to edit the "go to x: y:" and "set size to" script blocks to place your Pacman at the beginning of your maze and to ensure he is small enough to travel along the paths ..

 

10. Re-save your game.

 

11. Paint an enemy sprite and name it "Enemy 1" ..

Add these scripts to it. You will need to edit them so your enemy patrols along part of your maze ..

 

12. Re-save your game.

 

13. Copy your enemy sprite 4 or 5 times and edit their scripts until you have them patrolling different parts of the maze.

 

14. Now paint a health sprite ..

Add these scripts to it ..

 

14. Copy your health sprite 4 or 5 times and edit their scripts until you have them positioned in different parts of the maze.

 

15. Re-save your game.

 

16. Paint an objective sprite that you must reach to complete the game ..

Add these scripts ..

Edit the "go to x: y:" and "set size to" scripts so that your objective is placed at the end of the maze.

 

17. Re-save your game.

 

18. Paint a game over screen like this ..

Add these scripts to it ..

 

19. Re-save your game.

 

20. You're done. Test your game. Tweak your scripts and the positions of your enemies and healths so the game is challenging but enjoyable.