You are on page 1of 38

Game Maker: Maze Tutorial

TABLE OF CONTENTS
WHAT IS GAME MAKER? ................................................................................................................................................................... 2
GAME MAKER SCREEN ................................................................................................................................................................................ 2
LESSON 1 THE CLOWN GAME .......................................................................................................................................................... 4
SPRITES - CLOWN ....................................................................................................................................................................................... 4
BACKGROUND CLOWN .............................................................................................................................................................................. 6
SOUND BOUNCE ...................................................................................................................................................................................... 6
OBJECTS WALL & CLOWN ......................................................................................................................................................................... 6
CREATE EVENT THE CLOWN ....................................................................................................................................................................... 7
ALARM EVENT THE CLOWN ....................................................................................................................................................................... 9
COLLISION EVENT THE CLOWN HITS A WALL ................................................................................................................................................ 9
MOUSE EVENT HIT THE CLOWN ............................................................................................................................................................... 10
ROOMS ENTER THE CLOWN..................................................................................................................................................................... 11
LESSON 2 THE MAZE GAME ........................................................................................................................................................... 12
SPRITES BASIC WALL, PERSON & GOAL...................................................................................................................................................... 12
OBJECTS BASIC WALL, PERSON & GOAL .................................................................................................................................................... 12
EVENTS/ACTIONS PLAYER MOVEMENT ...................................................................................................................................................... 12
ROOMS MAZE 1 .................................................................................................................................................................................... 14
LESSON 4 MAZE GAME PART 2 ...................................................................................................................................................... 15
SPRITES DIAMONDS & 3-D WALLS ........................................................................................................................................................... 15
SOUNDS MUSIC & SOUND FX .................................................................................................................................................................. 16
BACKGROUND ROOM & SPLASH BACKGROUND ........................................................................................................................................... 16
FONTS SCORE FONT ............................................................................................................................................................................... 17
OBJECTS DIAMONDS & 3-D WALLS .......................................................................................................................................................... 17
CONTROLLERS .......................................................................................................................................................................................... 20
ROOMS SPLASH PAGE ............................................................................................................................................................................ 21
LESSON 5 MAZE GAME PART 3 ...................................................................................................................................................... 24
SPRITES MONSTERS, BOMBS & BLOCKS ..................................................................................................................................................... 24
SOUNDS OTHER SOUND FX ..................................................................................................................................................................... 25
OBJECTS MONSTERS, BOMBS & BLOCKS .................................................................................................................................................... 26
MONSTER COLLISIONS............................................................................................................................................................................... 27
THE BLOCK.............................................................................................................................................................................................. 28
MONSTER MOVEMENT ............................................................................................................................................................................. 29
THE HOLE ............................................................................................................................................................................................... 31
THE BOMB, TRIGGER & EXPLOSION ............................................................................................................................................................. 31
PLAYER SPRITE UPDATE ............................................................................................................................................................................. 33
SOUNDS - LIFE ......................................................................................................................................................................................... 33
OBJECTS PLAYER & LIFE .......................................................................................................................................................................... 33
ROOMS ADDITIONAL .............................................................................................................................................................................. 34
LESSON 6 COMPLETING THE MAZE GAME ..................................................................................................................................... 36
SPRITES ONE RING TO RULE THEM ALL ...................................................................................................................................................... 36
GAME INFORMATION ................................................................................................................................................................................ 37

1|P a g e

Game Maker: Maze Tutorial


WHAT IS GAME MAKER?
Game Maker is a program that can be used to create games quickly and easily, and without the need to learn a
programming language. Although the program allows you to create a game using the Game Maker scripting
language (GML), it is possible to create a game without using any programming code.
Game Maker works by using a series of events and actions to perform certain tasks in the game. An example of
this could be that when the left arrow key on your keyboard is pressed (event), a player on the screen will move
left (action). A summary of all the Game Maker events and their primary function is included after the final
lesson.
The following tutorials are based on the official PDF files available on the St Peters Intranet as well as from the
official Game Maker website. They have been modified slightly to make them easier to follow and understand.

Before You Start


You will need to copy the Game Maker folder from the S:/Resources directory to your home (H:) drive.

GAME MAKER SCREEN


After you start Game Maker the following screen should appear. Click on the Continue Using the Lite Edition
button.

2|P a g e

Game Maker: Maze Tutorial


If you are starting Game Maker for the first time it will be in Basic Mode. You will need to switch to Advanced
Mode as it has additional options that you will need a little down the track.
To change to Advanced Mode, click on the File menu and select Advanced Mode.

The main components used to create games in Game Maker include the following:
Component

Description

Prefix

Example

Sprites

This can be an image or a series of images such as animated gifs. Sprites contain
additional properties such as transparency, width, height, bounding box, collision
detection.

spr

sprPlayer

Objects

These are the living' actors that are given behaviours which respond to events. For
example, the arrow keys (events) will initiate their movement across the screen
(actions).

obj

objPlayer

Sounds

This can include sound fx (e.g. bouncing ball, laser shot) or background music for
the game. Game Maker allows the mp3, midi or wav format.

snd

sndMusic

Backgrounds

These are used to add background images to the game. This background can either
be static (still) or animated.

bgr

bkdRoom

Room

Rooms are the stage where the objects act'.

The other components of the Game Maker screen (paths, scripts, time lines) are used in the Advanced Mode.
They will not be needed at this stage of the tutorial.

3|P a g e

Game Maker: Maze Tutorial


LESSON 1 THE CLOWN GAME
You are going to create a simple game that involves using your mouse to click onto a clown that is moving
around the screen.

Resource Files
The files needed for this tutorial are located in the Lecture Resources/Resources 2 directory in the Game Maker
folder that was copied earlier.

SPRITES - CLOWN
1. Create a new Game Maker file (File>New) then save as CLOWN. Remember to save the file every few
minutes.
2. You will need to add a number of sprites for this game. To do this right-click on the Sprites folder and select
Create Sprite.

4|P a g e

Game Maker: Maze Tutorial


3. Click on the Load Sprite button and select the clown.bmp file from the Resources 2 folder. Ensure that the
Remove Background box is checked (this will make the background transparent) then click Open.

Type sprClown in the Name box then click OK.

4. Repeat the last two steps and load the wall image using an appropriate sprite name, e.g sprWall.

5|P a g e

Game Maker: Maze Tutorial


BACKGROUND CLOWN
5. Right-click the Backgrounds folder and select Insert Background.
6. Click on the Load Background button and select the background.bmp file then click Open.

Type background in the Name box then click OK.

SOUND BOUNCE
7. Right-click the Sounds folder and select Insert Sound.
8. Click on the Load Sound button and select the bounce.wav file then click Open. Type sndBounce in the
Name box then click OK.
9. Repeat the last two steps for the click.wav and music.mid files using appropriate sound names, e.g. sndClick,
sndMusic.

OBJECTS WALL & CLOWN


10. Right-click the Objects folder and select Insert Object.
11. Click on the Object Selection button
and select sprWall. Type objWall in the Name box and tick the
Solid and Visible checkboxes then click OK.

6|P a g e

Game Maker: Maze Tutorial

12. Repeat the last two steps for the sprClown sprite but do not make it solid.

Events/Actions
Attaching events and actions to objects gives life or interactivity to the game. An object might react to an
event (such as a collision with the wall) and its re-action might be that it bounces back off the wall.
There are many events and actions that can shape your game. Rather than explain the function of each event and
action available in Game Maker, you will learn some of these as you construct the Clown game. Use the Help
menu in Game Maker if you wish to learn a little more about them.

CREATE EVENT THE CLOWN


13. Ensure that the objClown object is active then click the Add Event button and select Create.

7|P a g e

Game Maker: Maze Tutorial

14. In the Main1 action list select the Play a Sound


action. Select the sndMusic sound file and set the loop
value to true. This will cause the music file to repeat
forever. Click OK.

15. In the Move action list select the Move Fixed


action. Click all 8 directional buttons. Dont include
the centre direction as this will stop the object from
moving. Set the speed to 4 (you can change this to a
higher value if you think the clown is moving too
slowly) then click OK. Note: By selecting the 8
different directions, Game Maker will randomly
choose which direction to move at the start of the
game.

16. To make the game less predictable we will add an alarm clock. In the Main2 action list select the Set Alarm
action. Set the number of steps to 50 and the in alarm no to Alarm 0.

8|P a g e

Game Maker: Maze Tutorial


ALARM EVENT THE CLOWN
17. Click the Add Event button and select Alarm then Alarm 0.

18. From the Move action list add the Move Fixed
19. From the Main2 action list add the Set Alarm
action. Click all 8 directional buttons and set the speed action. Set the number of steps to 50 and the in alarm
to 0 and check the relative box then click OK.
no to Alarm 0.

COLLISION EVENT THE CLOWN HITS A WALL


Ensure that the objClown is still open

20. Click the Add Event button and select Collision


with objWall event. In the Move action list select the
Bounce action. Accept the default settings and click
OK.
9|P a g e

21. In the Main1 action list select the Play a Sound


action. Select the sndBounce sound file and set the
loop to false (this will play the file only once). Click
OK.

Game Maker: Maze Tutorial


MOUSE EVENT HIT THE CLOWN
22. Click the Add Event button and select Mouse then Left button. In the Main1 action list select the Play
Sound action. Select the sndClick sound file and set the loop to false then click OK.

23. In the Score action list select


the Set Score action. Set the new
score value to 10 and check the
Relative box (this will ensure that
the score keeps accumulating by 10
points) then click OK.

24. In the Move list, add the Jump


To Random action and set both
snap options to 0.

25. In the Move list add the Move


Fixed action. Click the middle
(stop) directional button, set the
speed to 0.5 and check the Relative
box (this will ensure that the speed
of the clown gradually increases
each time you hit it) then click OK.

Check that the events and actions match the list below:
Create

10 | P a g e

Alarm 0

Collision with objWall

Left pressed

Game Maker: Maze Tutorial


ROOMS ENTER THE CLOWN
25. Right-click the Rooms folder and select Insert Room.
26. Because the size of the sprites are 32 x 32 pixels it would make placing the objects in the room a lot easier if
the Snap x and Snap y values were set to 32 (located at the top of the room dialog).
27. Click on the background tab then click the object selection button
created earlier.

and select the background that was

28. It is now time to add the objects that will form the basis of the clown game. Click on the Objects tab then
click the object selection button and select the objWall object.
29. Use the left mouse button to place the wall around the boundary of the room. If you make a mistake use the
right-mouse button to remove the object from the Stage.
30. Click the object selection button and select the objClown object and place one instance in the middle of the
room.

31. Save the file then press the Run Game

11 | P a g e

button to play and test the game.

Game Maker: Maze Tutorial


LESSON 2 THE MAZE GAME
You are going to create a maze game that involves using your keyboard to move your player around a number
of rooms.

Resource Files
The files needed for this tutorial are located in the Lecture Resources/Resources 3 directory in the Game
Maker folder that was copied earlier.

SPRITES BASIC WALL, PERSON & GOAL


1. Create a new Game Maker file (File>New) then save as MAZE. Remember to save the file every few
minutes.
Add the following sprites:
File

Name

Remove Background

wall.gif

sprWall

No

person.gif

sprPerson

Yes

goal.gif

sprGoal

Yes

OBJECTS BASIC WALL, PERSON & GOAL


2. Create objects for all the sprites above (objWall, objPerson, objGoal). Make sure that the objWall object is
solid.

EVENTS/ACTIONS PLAYER MOVEMENT


3. Ensure that the objPerson object is active (i.e. double-click objPerson) then click the Add Event button and
select Collision, objWall.

12 | P a g e

Game Maker: Maze Tutorial

4. In the Move action list select the


Move Fixed action. Click the
middle directional button (stop)
then click OK. In other words,
when the player hits a wall it will
stop moving. Therefore, it is not
important what value the speed is.

6. In the Control action list select


the Check Grid action. Type the
value 32 into both the snap hor and
snap vert box. This action will
make sure that the player doesn't
get stuck anywhere in the maze if
the sprite isn't aligned properly.

7. In the Move action list select the


Move Fixed action. Click the left
button and set the speed to 4 then
click OK.

5. Click the Add Event button and


select Keyboard, <Left>.
8. Using the table below to add the remaining Events and Actions for the objPerson object:
Event

Action List
Control

Keyboard <right>
Move
Control
Keyboard <down>
Move
Control
Keyboard <up>

Action
Check Grid

Move Fixed
Check Grid

Move Fixed
Check Grid

Move

Settings
snap hor: 32; snap vert: 32
Direction - Right button; Speed - 4
snap hor: 32; snap vert: 32
Direction - Down button; Speed: 4
snap hor: 32; snap vert: 32
Direction: Up button; Speed: 4

Move Fixed
Control
Keyboard <no key >

Check Grid

Move

Direction - Stop button (middle); Speed: 4


Move Fixed

13 | P a g e

snap hor: 32; snap vert: 32

Game Maker: Maze Tutorial


9. The events/actions for the objPerson object will allow the user to use the arrow keys to move the player up,
down, left and right. The <no key> event is included so that when the user releases any of these keys the player
will stop moving.
10. Open the objGoal object and add the following events/actions:
Event

Action List
Main1

Main1

Action
If next room exists

Go to next room

Settings
-

Transition (optional)

Collision objPerson
Control

Main 2

Else

Restart game

11. The events/actions for the objGoal object will allow the player to move to the next room (if it exists) once it
collides with objPerson object.

ROOMS MAZE 1
12. Add a new room (right-click on Rooms folder, Add Room)
13. Click the settings tab and change the room size to 480 x 480, caption to Simple Maze and the snap x and
snap y values to 32.
14. Click the objects tab then select the appropriate object to create the following room using the objWall,
objGoal and objPerson objects.

15. Save the game and test.

14 | P a g e

Game Maker: Maze Tutorial


LESSON 4 MAZE GAME PART 2
This is a continuation of the maze game created in the last tutorial. Open the maze file from lesson 3. In this
lesson, you will create an additional room in which you will need to collect diamonds before you can proceed to
the next level. You will adjust the walls of the room using different sprites so that it looks a little more realistic.

Resource Files
The files needed for this tutorial are located in the Lecture Resources/Resources 3 directory in the Game
Maker folder that was copied earlier.

SPRITES DIAMONDS & 3-D WALLS


1. Add the following sprites:
File

Name

Remove Background

wall_corner.gif

wall_corner

No

wall_horizontal.gif

wall_horizontal

No

wall_vertical.gif

wall_vertical

No

diamond.gif

sprDiamond

Yes

2. You will also need to create a sprite manually. Right-click the Sprites folder and select Add Sprite.
3. Click the Edit Sprite button then click the File>New to create a new sprite. Set the width and height to 32
then click OK. Double-click the transparent sprite that should now be visible on your screen. This will take you
into the Image Editor window.

4. Using the Fill Bucket

15 | P a g e

select a red colour from the palette then click on the image.

Game Maker: Maze Tutorial


5. Click the close and save button
Background box.

twice then name the sprite sprDoor and uncheck the Remove

SOUNDS MUSIC & SOUND FX


6. Add the following sounds:
File

Name

background_music

sndMusic

diamond

sndDiamond

door

sndDoor

goal

sndGoal

BACKGROUND ROOM & SPLASH BACKGROUND


7. Right-click the Backgrounds folder and select Add Background.
8. Click on the Load Background button and select the background2.bmp file, type bkgd_main in the name
box then click OK.
9. Create a Splash Page image background similar to the example below using Fireworks or Photoshop. The
image size should be 550 x 500 pixels. When you have finished, save the image as background_start (the
format can be either a gif, jpeg or png file).

10. Right-click the Backgrounds folder and select Add Background.


11. Click on the Load Background button and select the start_background file. Type background_start in the
name box then click OK.
16 | P a g e

Game Maker: Maze Tutorial


FONTS SCORE FONT
12. Right-click the Fonts folder and select Add Font. Modify the settings as shown below:

OBJECTS DIAMONDS & 3-D WALLS


13. Create objects for each of the sprites created earlier using the names objCor, objHor, objVer, objDiamond
and objDoor. Make all wall objects solid. Use the image as a guide to replace the old wall with the new wall
objects

17 | P a g e

Game Maker: Maze Tutorial


14. Set the Parent property to objWall as shown below. Because we want all the walls to behave like the
objWall object that was created in the last lesson, setting the parent property will save time as we don't have to
create a collision event for each wall type. Make sure that the other wall types have the objWall as the parent.

15. The objDiamond object is going to be used to accumulate points in the maze. Using the table below create
the following events/actions for the objDiamond object:
Event

Action List
Score

collision, objPerson

Main1

Main1

Action

Set the score

Play sound

Destroy instance

Settings
new score: 10; relative

sound: sndDiamond; loop: false

applies to: self

Events/Actions Summary
The sequence of events and actions will result in a score of 10 being added each time a diamond is collected.
The sndDiamond sound will then be played followed by the removal of the diamond from the screen.

18 | P a g e

Game Maker: Maze Tutorial


16. Open the objGoal object. It should still have a list of actions that you added in the previous lesson. Using the
table below add the following actions to the collision with objPerson event:
Event

Action List

Action

Settings

Score

new score: 100


relative

Main1

sound: sndGoal, loop: false

Main2

milliseconds: 1000

Main1
Control

Main1

collision, objPerson

Transition: fade out and in

Control

Control
Main2

Congratulations!

Score

new score: 500


relative

Score
Main2

Control

The final list of actions should look like the diagram below...

19 | P a g e

Game Maker: Maze Tutorial


Events/Actions Summary
The sequence of events and actions will result in a score of 100 being added followed by the sndGoal sound
being played and a pause of 1 second. The game will then check if another room exists. If the room exists then
the game will proceed to that room. Otherwise, a congratulations message will appear, a score of 500 will be
added, the highscore table will be shown followed by the game restarting. Note the use of the start and end
block. The start and end block actions must be used each time an If action (e.g. If the number of instances is a
value) is followed by two or more other actions (e.g. Play sound and Destroy instance actions).
17. Using the table below add the following events/actions for the objDoor object:
Event

Action List
Control
Control

collision, objPerson

Main1

Main1
Control

Action

If the number of instances is a value

Settings
object: objDiamond; number: 0; operation: Equal to

Start of block

Play sound

Destroy instance

sound: sndDoor; loop: false

applies to: self

End of block

Events/Actions Summary
The sequence of events and actions will result in the objDoor object being used to block the objGoal object in
the maze. The door will open (i.e. it will disappear) and the sndDoor sound played after all the diamonds have
been collected by the player, i.e. when the number of diamonds is equal to 0.

CONTROLLERS
Controllers are objects that perform actions based on events but are not actually seen by the player and therefore
do not require any sprites to be created. The maze game requires two controllers: the first controller will be used
at the start of the game (to reset the score amongst other things) while the second one will be used in every room
(e.g. to keep track of the score, etc.).
18. Right-click the Objects folder and select Insert Object. Type controller_start in the Name box and uncheck
the Visible box.

20 | P a g e

Game Maker: Maze Tutorial


19. Using the table below add the following events/actions for the controller_start object:
Event

Action List

Action

new score: 0

Score
Main1
Create

Settings

show score: don't show; show lives: don't show

Score
new lives: 3
sound: sndMusic; loop: true

Keypress <any key>

Main1

transition: fade out and in

Events/Actions Summary
The sequence of events and actions will result in the score being reset to 0, background music being played and
the scores being hidden. When a key is pressed the game will move to the next room.
20. Right-click the Objects folder and select Insert Object. Type controller_main in the Name box and uncheck
the Visible box.Using the table below add the following events/actions for the controller_main object:
Event

Draw

Action List

Action

Settings

Draw

font: score_font

Draw

color: red

Score
x: 0, y: 0, caption: Score; Relative
text: Lives; x: 90; y: 0; relative
x: 150; y: 0; sprite: sprHeart

Events/Actions Summary
The sequence of events and actions will result in the controller being used to set the font colour and position of
the score.

ROOMS SPLASH PAGE


21. Add a new room (right-click on Rooms folder, Add Room)
22. Click the settings tab and change the room size to 480 x 512, caption to A-Mazing! , the snap x and snap y
values to 32 and room_start in the Name box.
23. Click the background tab then click the add

21 | P a g e

button and select the background_start background.

Game Maker: Maze Tutorial


24. Click the objects tab then select the controller_start object and place anywhere in the room. The object
appears as the following symbol
in the room.

25. Open room1 and modify the room size to a height of 512. Place the controller_main object in the bottom
left corner.

26. Add a new room (right-click on Rooms folder, Add Room) to create room2.
27. Click the settings tab and change the room size to 480 x 512, caption to Collect all the diamonds! , the snap
x and snap y values to 32 and type room2 in the Name box. Place the controller_main object in the bottom left
corner as well as the other objects so that it looks like the example below.

22 | P a g e

Game Maker: Maze Tutorial


28. Re-order the rooms by dragging the room up or down so that they are in the following order: room_start,
room1, room2.
29. Save the game and test. If you are finding that the player gets stuck when it hits the wall, you will need to
open the each of the sprites and uncheck the Precise Collision Checking option.

23 | P a g e

Game Maker: Maze Tutorial


LESSON 5 MAZE GAME PART 3
This is a continuation of the maze game created in the last tutorial. Open the maze file from lesson 4. In this
lesson, you will add the extra challenge of trying to avoid monsters in the maze. You will also use bombs to
explode walls...

Resource Files
The files needed for this tutorial are located in the Lecture Resources/Resources 3 directory in the Game Maker
folder that was copied earlier.

SPRITES MONSTERS, BOMBS & BLOCKS


1. Add the following sprites:
File

Name

Remove Background

monster1_nice.gif

sprMonsterlr

Yes

monster2_nice.gif

sprMonsterud

Yes

monster3_nice.gif

sprMonsterall

Yes

person.gif

sprLives

Yes

bomb.gif

sprBomb

Yes

trigger.gif

sprTrigger

Yes

explosion.gif

sprExplosion

Yes

block.gif

sprBlock

Yes

Open the sprMonsterlr to view the image. Click on the next subimage button
. You should notice that the
sprite is made up of a number of different images (similar to an animated gif). We will take advantage of this a
little later in the tutorial as we will be able to display the relevant view of the monster sub-image depending on
which direction it is going. Look at the other sprites to see their sub-images...
2. You will also need to create a new sprite manually. Right-click the Sprites folder and select Add Sprite.
3. Click the Edit Sprite button then select the File menu and New. Enter 32 for both the Width and Height
values then click OK.

24 | P a g e

Game Maker: Maze Tutorial


4. Double click on the blank sprite. This will take you into the Image Editor window. Using the Fill
Bucket

select a green colour then click on the image.

5. Click the close and save button


twice then name the sprite sprHole and uncheck the Remove Background
button. You should now have the following sprites:

SOUNDS OTHER SOUND FX


6. Add the following sounds:
File

Name

dead.wav

sndDead

explode.wav

sndExplode

hole.wav

sndHole

push.wav

sndPush

You should now have the following sounds. Note: the names might be slightly different

25 | P a g e

Game Maker: Maze Tutorial


OBJECTS MONSTERS, BOMBS & BLOCKS
7. Create objects for the new sprites from the previous step. Ensure you name the various objects using the
names example below.
Sprite

Object

sprMonsterlr

objMonsterlr

sprMonsterud

objMonsterud

sprMonsterall

objMonsterall

sprLives

objLives

sprBomb

objBomb

sprTrigger

objTrigger

sprExplosion

objExplode

sprBlock

objBlock

sprHole

objHole

Make sure that objBlock and objHole are set to solid.


You should now have the following objects (the names might be slightly different):

26 | P a g e

Game Maker: Maze Tutorial


MONSTER COLLISIONS
8. The objPerson object needs to be modified to take into consideration its collision with the newly created
monsters. Using the table below add the events/actions for the objPerson object. Hint: Once you create the
actions for the collision with monster_lr, you can duplicate the event (right-click the event>Duplicate Event)
and change the collision to the appropriate monster.
Collision with objMonsterlr
Event

collision, objMonsterlr

Action List Action

Settings

Main1

sound: sndDead, loop: false

Main2

milliseconds: 1000, redraw: true

Score

lives: -1, relative

Main1

transition: fade out and in

The actions applied to the collision with objMonsterlr will be exactly the same for when the player collides with
the other monsters. Rather than repeating the above steps, you will duplicate the actions and events instead
9. Right click the collision with objMonsterlr event and select Duplicate Event. Select Collision then click
objMonsterud.

10. Right click the collision with objMonsterlr event and select Duplicate Event. Select Collision then click
objMonsterall.

27 | P a g e

Game Maker: Maze Tutorial


Events/Actions Summary
The sequence of events and actions will result in the sndDead being played, a pause of 1 second, the loss of one
player life and the restart of the room when the player collides with any of the monsters.

THE BLOCK
9. (i) Using the table below add the following events/actions for the objBlock object:
Event

Action List
Control

Action

Settings
x: 8*other.hspeed,
y: 8*other.vspeed, relative
objects: All

Control
Main1

sound: sndPush, loop: false

Move

x: 8*other.hspeed
y: 8*other.vspeed, relative

Control
collision, objPerson
Control

Control
Control

object: objHole,
x: 8*other.hspeed,
y: 8*other.vspeed, relative

Move

x: 8*other.hspeed, y: 8*other.vspeed,
relative

Control

(ii) Add the following event to the objPerson object:


collision objBlock

Control

comment: do nothing

Events/Actions Summary
(i) The sequence of events and actions that are applied to the objBlock object will result in the player being able
to move the objBlock around the room. If the objHole object is standing in the way, the objBlock object can be
used to remove the obstruction. (ii) The purpose of the objPerson collision with objBlock event (although
appearing to do nothing) is to allow the player to make contact with the block so that they can move the block.

28 | P a g e

Game Maker: Maze Tutorial


MONSTER MOVEMENT
10. Using the table below add the following additional events/actions to the monster_lr object:
Event

create

step, end step

collision, objWall

Action List

Action

Settings

Control

snap hor: 32; snap vert: 32

Move

direction: left, right, Speed: 32/6

Control

variable: hspeed, value: 0; operation: smaller than

Main1

sprite: sprMonster1, subimage: 3, speed: 0

Control

Main1

sprite: sprMonster1, subimage: 2, speed: 0

Control

snap hor: 32; snap vert: 32

Move

Events/Actions Summary
Create event - This will start the monster moving in either a left or right direction. Step event - This will check
to see if the monster is moving left or right. When hspeed is less than zero (i.e. moving from right to left) the
image needs to face left. The Change Sprite action will make sure that the monster is facing the correct
way. Collision event - This will move the monster in the opposite direction when it hits a wall.
11. Using the table below add the following additional events/actions to the monster_ud object:
Event

create

step, end step

Action List

Settings
snap hor: 32; snap vert: 32

Move

direction: up, down, Speed: 32/6

Control

variable: vspeed, value: 0; operation: smaller than

Main1

sprite: sprMonster2, subimage: 0, speed: 0

Control

Main1

29 | P a g e

Action

Control

sprite: sprMonster2, subimage: 1, speed: 0

Game Maker: Maze Tutorial


Control
collison objWall

snap hor: 32; snap vert: 32

Move

12. Using the table below add the following additional events/actions to the monster_all object:
Event

Action List

Action

Settings

Control

snap hor: 32; snap vert: 32

Move

direction: up, down, left, right, speed: 32/6

Control

snap hor: 32 snap ver: 32

Control

sides: 8

Move

direction: up, down, left, right, speed: 32/6

Control

variable: hspeed, value: 0, operation:


smaller than

Control

variable: image_index, value: 3

Control

variable: hspeed, value: 0, operation: larger


than

Control

variable: image_index, value: 2

Control

variable: vspeed, value: 0, operation:


smaller than

Control

variable: image_index, value: 1

Control

variable: vspeed, value: 0, operation: larger


than

Control

variable: image_index, value: 0

Move

direction: direction + 90 speed: 32/6

Control

x: hspeed, y: vspeed, relative

Control

Move

direction: direction + 180 speed: 32/6

Control

x: hspeed, y: vspeed, relative

Control

Move

direction: direction -90 speed: 32/6

create

step, step

step, end step

collision, objWall

30 | P a g e

Game Maker: Maze Tutorial


Events/Actions Summary
The sequence of events and actions for the first two monsters will result in the monsters moving horizontally for
monster1 and vertically for monster2. When objMonsterlr hits either wall it will bounce in the other horizontal
direction. The sprite will also change so that the monster is facing in the correct direction, hence the use of the
image_index property. This is similar for objMonsterud except that it will move vertically and bounce in the
other direction when it hits the wall. objMonsterall is a little more complicated in that its movements can be one
of four possibilities (up, down, left, right). The use of the chance action is to provide some unpredictability to its
movement so that the monster will suddenly change direction.

THE HOLE
13. Using the table below add the following events/actions for the objHole object:
Event

collision, objBlock

Action List

Action

Settings

Main1

sound: sndHole, loop: false

Main1

applies to: self

Main1

applies to: other

Events/Actions Summary
The sequence of events/actions ensures that when the objBlock object makes contact (collides) with the objHole
object, both objects are removed. The sndHole effect is also played.

THE BOMB, TRIGGER & EXPLOSION


14. Using the table below add the following events/actions for the objTrigger object:
Event

collision, objPerson

31 | P a g e

Action List

Action

Settings

Main1

sound: sndExplode

Main1

object: objBomb, change into: objExplode,


perform events: yes

Main1

applies to: self

Game Maker: Maze Tutorial


15. Using the table below add the following events/actions for the objExplode object:
Event

create

other, animation end

Action List

Action

Settings

Move

x: -200, y: -200, relative

Main1

x: 200-16, y: 200-16, relative

Main1

x: 200-16, y: 200+16, relative

Main1

x: 200-16, y: 200+48, relative

Main1

x: 200+16, y: 200-16, relative

Main1

x: 200+16, y: 200+16, relative

Main1

x: 200+16, y: 200+48, relative

Main1

x: 200+48, y: 200-16, relative

Main1

x: 200+48, y: 200+16, relative

Main1

x: 200+48, y: 200+48, relative

Move

x: 200, y: 200, relative

Main1

applies to: self

Note: The x and y values for the Destroy instances at a position action requires a little trial and error so that the
relevant parts of the room are 'destroyed'.

Events/Actions Summary
The sequence of events and actions in the objTrigger object will result in the objBomb object being transformed
into the objExplode object and the bomb being removed. The objExplode sequence of events and actions will
result in the explosion causing any objects in the vicinity to be destroyed. The animation end event is to ensure
that the animated explosion sequence doesn't repeat forever.

32 | P a g e

Game Maker: Maze Tutorial


PLAYER SPRITE UPDATE
1. Replace sprPerson and sprLives with person_nice.gif. Add the following sprite:
File

Name

Transparent

life.gif

sprHeart

Yes

SOUNDS - LIFE
2. Add the following sound:
File

Name

life.wav

sndLife

OBJECTS PLAYER & LIFE


3. The objPerson object uses an animated sprite (GIF) that contains a number of different images of the player
going up, down, left and right. The images below illustrate...
Player left

Player right

Player down

Player up

To take this into account, we will need to create additional events and actions. Using the table below, add the
new events and actions to the objPerson object:
Event
create
keyboard <left>

keyboard <right>

33 | P a g e

Action List

Action

Settings

Main1

sprite: sprPerson, subimage: 0

Main1

sprite: sprPerson, subimage: 3

Control

snap hor: 32; snap vert: 32

Move

Direction: left, Speed: 4

Main1

sprite: sprPerson, subimage: 2

Control

snap hor: 32; snap vert: 32

Move

Direction: right, Speed: 4

Game Maker: Maze Tutorial


keyboard <up>

keyboard <down>

Main1

sprite: sprPerson, subimage: 1

Control

snap hor: 32; snap vert: 32

Move

Direction: up, Speed: 4

Main1

sprite: sprPerson, subimage: 0

Control

snap hor: 32; snap vert: 32

Move

Direction: down, Speed: 4

4. Using the table below add the following additional events/actions to the objLife object:
Event

collision objPerson

Action List

Action

Settings

Score

sound: sndLife, loop: False

Main1

new lives: +1, relative

Main1

applies to: self

Events/Actions Summary
The sequence of events and actions in the keyboard events for the objPerson object will result in the relevant
subimage displaying when the player is facing left, right, up or down. The objLife collision with the player will
result in an extra life being added to the game.

ROOMS ADDITIONAL
16. Add four more rooms using the settings listed. Ensure that all rooms have the main_controller placed in the
bottom left-corner as well.
Hint: To save yourself time you can duplicate the rooms. Right-click on the room then select Duplicate

34 | P a g e

Game Maker: Maze Tutorial


Name: room3, Caption: Watch out for the monsters!,
Snap x: 32, Snap y: 32, Width: 480, Height: 512

Name: room3, Caption: Hidden flag!, Snap x: 32, Snap y: 32,


Width: 480, Height: 512

Name: room3, Caption: Use the rocks!, Snap x: 32,


Snap y: 32, Width: 480, Height: 512

Name: room3, Caption: Bombs away!, Snap x: 32, Snap y:


32, Width: 480, Height: 512

17. Ensure that the rooms are in the following order: room_start, room1, room2, room3, room4, room5, room6.
18. Save the game and test.

35 | P a g e

Game Maker: Maze Tutorial


LESSON 6 COMPLETING THE MAZE GAME
This is a continuation of the maze game created in the last tutorial. Open the maze file from lesson 5. In this
lesson, you will create one more room, modify the game controller and add a users guide...

Resource Files
The files needed for this tutorial are located in the Lecture Resources/Resources 3 directory in the Game Maker
folder that was copied earlier.

SPRITES ONE RING TO RULE THEM ALL


1. Add the following sprite:
File

Name

Remove Background

ring.gif

sprRing

Yes

2. Create an object using the sprRing sprite and name it objRing.


3. Add the following additional events/actions to the objRing object:
Event

Action List

Action

Settings

Main1

Applies to: self

Score

New score: 250; relative

Collision, objPerson

4. Add the following room to the game using the same settings as the other rooms. Make up your own caption:

36 | P a g e

Game Maker: Maze Tutorial


5. Using the table below add the following additional events/actions to the main_controller:
Event

Action List

Action

Settings

Main1
keyboard, letters, N

keyboard, letters, P

keyboard, letters, R

Main1

Transition fade out and in

Main1

Transition optional

Main1

Transition optional

Score

Colours are optional


-

other, no more lives


Main2

draw

Score

Font: score_font, Align: left

Draw

Colour: yellow

Score

x: 300, y: 4, caption: Score, relative

Draw

text: Lives, x: 8, y: 4, relative

Score

x: 70, y: 4, image: sprLives, relative

Events/Actions Summary
The sequence of events and actions in the keyboard events for the main_controller object will give the user
some basic cheats when playing the game. If they press the letter N it will go to the next room (if it exists).
When the P letter is pressed it will go to the previous room and R will restart the current room. The draw event
will display the score and lives.

GAME INFORMATION
6. The game information section in Game Maker can be used to create a basic user's help guide. Double-click
the Game Information (
) button then type the following:

37 | P a g e

Game Maker: Maze Tutorial

7. Further customisation of the game can be made in the game settings dialog. Double-click the Global
Settings
button and modify the Other tab as shown below:

8. Save and test the game.

38 | P a g e

You might also like