Skip to Content

How to Build a Simple Pac-Man Game

For today's program, we are going to build a simple Pac-Man game. Pac-Man was one of the very first arcade games developed around 1980.


For today's program, we are going to build a simple Pac-Man game. Pac-Man was one of the very first arcade games developed around 1980. For our version of Pac-Man we are going to focus on the following programming and problem solving techniques:



a. Using Scratch to develop computer objects (also known as Object Oriented Programming classes) that will interact with each other in the game. We will only develop five sprites with scripts for this program (7 in total for the game) but will be using copies of the sprites to make a complete fully interactive video game (inheritance principle). Object Oriented Programming is a complex topic and this program will not use design patterns which are a hallmark of OOP. Your next project, the Marble Roll Game, will start to explore this area however.


b. Developing simple animation of characters in the game. Animation code (blocks) will be kept separate from functionality code (blocks) so that sprites can be reused with simple changes to the costumes and minor changes to some variables. This is how computer languages and scripts that are fully object oriented (such as Action Script 3 for Flash or Java) work.


 This lesson is designed for intermediate to advanced users of Scratch who have had some experience in working with the software and developing Scratch applications. Basic concepts such as how to create new sprites, where to write scripts, etc. will not be reviewed. The software in this series of lessons only covers creating a single level for this version of Pac-Man, however, the software has been written so that multiple levels are easy to add with simple changes to variables. We will discuss how to do this briefly at the end of the lesson.



Other Files: 
Hi Willa,

I've been trying to download this file but do not seem to be abe to. Am I doing something stupid? Could you please tell me step by step how I go about downloading this. I can only open it and that reveals lots of garbbage text.

Hi Mike,

Sure thing!

From the Scratch site, create a new project, go to file > upload from your computer > select the pacman sb2 file. Click yes when the pop-up window asks if you want to replace the contents of the current project.

Let me know if that works!

Hi Wade. Ive read through the PDF document and the game looks great and I would love to get my pupils started on learning this. I cannot seem to download the file to my laptop though so I can show them pieces of the code as they progress. Im new to ScratchEd so do not know the protocol. Any help much appreciated. Mike
Hi Mike,

It looks like the file wasn't named correctly. I've attached a new file and renamed it (sb2 is the extension for Scratch projects).

Let me know if you can download it now.

Hi Wade, I'm a reference Librarian working in the Australian public library sector. I've been relying on your Pac-Man scripts to help teach local high school kids how to script in Scratch. thanks heaps :). I was wondering however, could you provide me with a few tips to create a new level? any help would be appreciated