Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

Designing and Scoring a Pac-Man Style Maze Game with Flash

  • Print
  • + Share This
Games are like life—they are all about interaction. Unlike life however, most games come with a set of instructions. This Pac-Man–style game has an introduction that serves both to introduce the character Puffin to the user and to offer a brief set of instructions to the game.
This chapter is from the book

This chapter is from the book

by Aria Danika
with character design by Chris Norman

Figure 5.1Figure 5.1

Aria Danika is an interactive developer/artist, senior moderator at, and member of the Hypermedia Research Centre in London.

I grew up playing games. However, most of my early experiences with video games were limited to arcades, friends' houses, and trying to convince my parents that an Atari 2600 was something no family should be without.

One of my favorite early games and sources of inspiration was a simple, random-generated maze titled Diamaze (1990), designed by Steve Herring. Diamaze was a puzzle/maze game where you have about a minute to collect as many diamonds as you can, using your keyboard arrow keys, before the lights go out.

Tile-based games have been around for a very long time and can serve as a clever way to build a game environment without consuming too much memory. The main aspect of this technique involves slicing up your game background into reusable square blocks. Then you place them together (tile) using code in order to build a map that acts as the data structure for the game. This technique is similar to the concept of using reusable symbols in your Flash movie to save time and space.

It Works Like This

This game is constructed using tiles (also known as cells), which are square graphics stored as movie clips. These are "tiled" using ActionScript to generate the game environment: a top-down maze. Complete with sound effects and a scoring feature, users are able to use the arrow keys to move the character and collect balloons. Here are the basic steps of the project:

  1. Attach the script that allows the user to begin the game.

  2. Attach two reusable tree maze tiles dynamically with ActionScript to construct the game field.

  3. Insert the main character dynamically, by assigning Linkage properties to the movie clip.

  4. Write a custom collision-detection script that calculates the position of the main character against the bounds of the tree tiles and the balloons.

  5. Set up the character movement by creating motion Listeners that check for key presses.

  6. Keep game score by counting the number of collisions with collectable items and displaying the output in a text field.

  7. Attach sound effects to provide feedback to your user when he is interacting with your game.

Figure 5.2Figure 5.2 To begin, you'll set up the character introduction and maze.

Figure 5.3Figure 5.3 Then the fun begins. See how many balloons you can collect.

  • + Share This
  • 🔖 Save To Your Account