A Two Room Maze Game

In Moving on With Game Maker – A Maze Game, we looked at a couple of ways of how to get a player character to move under keyboard control.

Now it’s time to actually put a maze game together.

Defining Your Maze

If you played (or watched) the Pacman game, you’ll be familiar with the sort of maze I’m thinking of when I talk of a maze game – a walled area, populated by treasure and monsters; the player character has to get to get the chequered flag, avoiding the monstaers and collecting as much treasure as possible.

We’ll also cover how to improve the aesthetics of the maze, to produce something like this, for example:

(The study of maze and labyrinth design is actually quite involved. For an introduction, see An Introduction to the Typology of Labyrinths and Mazes (5 points for the first person to comment about what distinguishes a maze from a labyrinth;-))

With the room selected, add wall blocks to the room to create your maze. Place an instance of the player object at a start position within the maze and a goal object at the required end point within the maze.

In some games, there is the convention of leaving gaps in the the wall of the maze that correspond to that start and goal squares (that is, the entry to, and exit from points of the maze). We shall see later how a door can be added to the exit that bars further progress until it has been opened by completing a particular task.

Play the game. with the movement style and player speed you have selected, how easy is it to navigaet through the maze and get to the goal?

If you find you can’t get the player character to line up with the grid and get through narrow gaps in the wall, or it keeps getting stuck against the ends of the walls, add a Check Grid Alignment action to the player object before changing direction.

Adding a second room

It is possible to add a large number of rooms to your game and move from one to the next as you complete the challenge offered by each room. To create a second room for your maze game, simply select the Create Room option for a second time from the Game Maker Resources menu. Draw a maze using wall objects, and add the player object where you want it to enter the room, and a goal object where you want the player to leave the room.

One of the simplest ways of implementing the move from one room to another is to specify a particular goal within the first room, such that when the player character reaches it (that is, collides with it), the action moves to the next room.

In the goal object, inspect the collision event that tests for a collision with the player character. In the Main1 actions tab, you should see a set of actions relating to Rooms. Select the Check Next action.

This is a particular sort of action known as a conditional action. The action will test the state of the game world (in this case, to see if there is another room after the current room) and if the test succeeds then the next action will be executed. If the conditional test fails (there are no further rooms, for example, as may be the case when play is in the final room) then the next but one action (if any) will be executed next.

Configure the goal so that if there is another room the player moves to it, otherwise, end the game.

Add an instance of the goal object to the first room. When the player reaches the goal, play should move on to the next room.

Play the game – when you complete the first room, does the the player move to the second room? Does the game end when the goal in the second room is reached?

Without changing any of the objects, you can add as many rooms as you like, each describing a different maze (remember to add the player character where you want it to enter the room and the goal object at the exit). You can reorder the rooms by dragging and dropping them to rearrange them within the Rooms folder in the Game Maker sidebar.

Can you make one room more difficult than another, just by the way the walls are positioned?

7 Responses to “A Two Room Maze Game”

  1. 1 louise March 15, 2008 at 7:08 pm

    >what distinguishes a maze from a labyrinth

    You wouldn’t find David Bowie in a maze?

    I think that you have to find a path through a maze by making choices which way to go whereas you’d follow a set path (or one of the paths) through a labyrinth.

  2. 2 garth williams May 9, 2010 at 11:02 pm

    A labyrinth can be three dimensional, a maze only 2-D?

  3. 3 Matthew May 18, 2010 at 3:11 pm

    Dam someone got here befor me

  4. 4 Chris Cox May 17, 2011 at 3:44 pm

    In a Labyrinthe aren’t you trying to get to the centre, but a maze you are trying to find the exit? Anyway – the link to *An Introduction to the Typology of Labyrinths and Mazes* seems to be broken which is a shame.

    I think it’s here though:


    and, as a side point, having now read that site, aparently a labyrinthe only has one path, mazes can have more choices.

  5. 5 Trevor May 20, 2011 at 7:02 pm

    I think generally a maze is thought of as 2D, but both mazes and labyrinths can be 3-dimensional though a labyrinth itself can be taken as something being generally covered, or underground.

  6. 6 Alan Williams October 14, 2011 at 9:49 am

    From what I can tell, a labyrinth is made of a single path that eventually reaches the center while a maze has branching paths that may or may not reach an exit.

  1. 1 Adding Monsters to the Maze Game « Digital Worlds - Interactive Media and Game Design Trackback on March 16, 2008 at 12:03 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


%d bloggers like this: