You are on page 1of 22

Game Maker tutorial 1 – Page 1

Game Maker Tutorial 1: Catch the Clown

This tutorial is meant to get you started with Game Maker using a step-by-step process that introduces a
number of basic concepts that the software uses. Follow this tutorial carefully and make sure you grasp all
the steps. Once you finished this first game, the others will become easier.

II. The „Design Document‟ for Catch


the Clown: Thinking & Planning Catch the Clown screen shot.

1. Introduction: Catch the Clown is a This game might be more accurately


Look called Click the CLOWN.
simple Action game where a
Did you notice that
this Design Docu- CLOWN icon bounces around inside
ment for Catch the an arena and players „catch‟ it by
Clown, although clicking on it, thus increasing their
abbreviated, uses
the Case System score. This becomes more
structure? challenging as the CLOWN‟s speed
I think that you did… increases over time. The playing
time is approximately 5 minutes.
2. Game Components:
2.1 Terrain: We‟ll need one item: a WALL image.
In the game, the WALL does nothing but keep the CLOWN from exiting the arena.
2.2 Units: We‟ll need one item: a CLOWN image.
In the game, the CLOWN will bounce around at ever-increasing speed and occasionally teleporting about the
arena. The player is awarded points when the CLOWN is clicked on by the mouse.
2.3 Audio: We‟ll need two sounds: 1) a „bounce‟ sound used when the CLOWN hits a WALL and bounces back
into the arena; and 2) a „click‟ (reward) sound that is used when the player successfully clicks the mouse on
the CLOWN.
2.4 User controls: We‟re just using the mouse; players click the left-mouse button on the CLOWN.
3. Setup: In an arena surrounded by WALLs, a CLOWN begins moving randomly and bouncing around.
4. Sequence of Events: Starting with a score of „0,‟ the player uses the mouse to click on the CLOWN and
increase their score.
5. Levels: There is one level; the game difficulty increases not by level, but by the increasing speed of the
CLOWN after each successful „catch.‟

6. Ending the Game: The game ends when the player presses the <Esc> key
7. Victory Conditions: It‟s all about the high score, baby!

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 2

III. Adding Sprites and Sounds


Procedure: Creating a game using Game Maker takes us back to the kitchen. That is, the culinary art
of creating games using this software is in having all the ingredients ready and standing by before you
start to mix them together to create a game prototype. Thus, each new game‟s creation begins with a
scavenger hunt for the ingredients listed in Rule 2, Game Components.

A. We need to muster two images for Catch the Clown: a WALL (see Case 2.1, above) and a CLOWN
(2.2). You can make your own Sprites of course, using any drawing program you like. Game Maker
even has its own drawing tools. Alternately, there are libraries of such art to be found by searching
the internet (with many provided on the Game Maker web site). This tutorial comes with Sprites
already provided in the „Resources‟ folder, so for now, let‟s use those „default‟ Sprites.

B. To add Sprites to a game you‟re creating using Game Maker, go to the menu and select Add and then
choose Add Sprite. You‟ll see the following „form‟ window appear:

Sprites
The 2D images used in
Game Maker are called
“Sprites.”

Then press the Load Sprite button and select the file that contains the CLOWN image from the
„Resources‟ folder. This will show that Sprite in the form window.

Fill in the Name field and give the Sprite a name that will serve you well as you create this game.

Call it spr_CLOWN_JM. This name begins with “spr” to indicate that it is a


Sprite file, the underscore is required, and the “CLOWN” tells you which Sprite file this one is. Good
file naming conventions like this are vital when making computer games!

1 Library

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 3

2 draw tools in gamemaker use the edit button


3 use own sprites

1. The Load Sprite button.


2. When the CLOWN image is added you‟ll see it here.
3. “Transparent” background is good; leave this box checked off.
4. Change the name from “Sprite1” to “spr_CLOWN_INTIALS
” (meaning “Sprite: CLOWN”)
5. As you add art and a proper name to your creation, you‟ll also see it listed here.

When the screen looks like it does above, press the OK button to add that Sprite to your game.

Important: Then do the same for the WALL Sprite, giving it the Name of
Long May
They Wave spr_WALL_INTIALS,
„Wave‟ files are great
for short sound effects C. You‟ll discover that as you add (“define”) Sprites, sounds, Objects, Rooms, and other files to your
and, while you can
game, they appear on the left window of the program. This is a handy list of all the resources (or
make your own with
some expertise, the “assets”) that you can quickly select from when you want to change (Edit), duplicate, or delete it
internet is full of cool by right-clicking on the resource name. This feature will prove its power as you make more
.wav files. complicated games.
Naturally, the Game
Maker web site has
some for you, and this
D. With the Sprites are added, we must now add the sound effects
tutorial comes with its using two .wav files from the „Resources‟ folder.
own in the in the
„Resources‟ folder. From the menu, select Add and then Add Sound. You‟ll see the
Heck, open up
Windows Explorer and
search for *.wav files
and look how many are Alan Emrich. tutorial
already on the
computer you‟re using
right now!
Game Maker tutorial 1 – Page 4

form on the right appear. Press the button labeled Load Sound and select the “bounce” file in the
Resources folder. This is the sound the CLOWN will make when bouncing off the WALL.

Rename the file snd_bounce_intials (for “sound: bounce”) and go ahead and click on the
Green Right Arrow button it listen to it. When you have this file all organized and renamed, you‟ll
be looking at the following screen. Press the OK button to lock this asset in.

1. The Load Sound button.


2. Try the Green Right Arrow button to
hear the sound file.
3. Change the name from “sound1” to
“snd_bounce_intials” (meaning “Sound:
Bounce”)
4. On the left, you‟ll see our CLOWN and
WALL Sprites, in addition to our newly
added sound asset.

Important: Then do the same for the click sound, giving it the Name of snd_click.

This would be a good point to save your


game file!

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 5

On the menu select File and then Save As…


Go ahead and name it Lastname_Catch the
Clown.

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 6

IV. Adding Objects and Actions


Procedure: Sprites and sounds are just “assets.” Right now, they exist in your game, but they‟re not
doing anything. They exist as files, but have not yet defined their use; Sprites must be defined as
game Objects and sounds won‟t play until we tell them to. Let‟s begin explaining how game Objects
work in Game Maker (and most other game design systems, for that matter). Pay attention!

A. The assets we‟ve created are used to create game Objects (out of the Sprites and sounds).
To make the game, one or more instances of these game Objects appears in the game
world (see the sidebar to help you grasp the difference between an Object and an instance
The Difference
Between an ‘Object’
of it in the game).
and ‘Instances’ of
Those Objects
Note that there can be more than one instance of an Object present on the screen (within
An Object defines a
particular game Object the game world). For example, in Catch the CLOWN, there will be a large number of
with its behavior (that is,
reaction to Events). Of
instances of the WALL Object, but only one instance of the CLOWN Object.
this Object there can be
one or more instances
(copies of it) actually in Now, instances of game Objects don‟t do anything in your game until you tell them to.
the game. Each You do this by indicating how the instances of the Object must react to Events that happen
instance will act
according to the defined during the game. Note that there are many, many types of Events that can happen!
behavior for that Object.
Stated differently, an
Object is an abstract 1. In The Beginning: The first Event is usually the Create Event.
thing, while an instance
is a copy of it that we This tell a piece that was just “put on the board” what to start doing
use to play the game.
(i.e., move around and not just sit there).
For example we might
have multiple instances 2. Ouch: Another important Event happens with two instances collide.
(lots of monsters) of a
monster object in a This is called a Collision Event. In Catch the Clown, when the CLOWN collides with an
game. When we talk
about the monster instance of the WALL, it will react by „bouncing‟ off it and changing its direction.
object we mean all the
instances of the 3. Hey, I Felt That: When a player presses a key or clicks the mouse on an instance,
monster in the game.
When we talk about the
things can also happen.
instance we mean one For the CLOWN, we‟ll use a Mouse Event to make it react and add points to our score.
particular instance of
the monster.
And it‟s not enough to specify what the Events are, you must also indicate what Action
Here’s a better occurs with that Event. Game Maker provides a wide assortment of Actions (and there‟s a
example. In a Chess
game, we create a lot more than what you see, as you‟ll discover in Advanced Game Prototyping). We are
piece for it called
obj_king_black. We only
using the advanced mode
need one instance of Examples include Actions that set the instance of an Object in motion in a particular
that Object in the game.
But for direction, or change the score, or play sounds.
obj_bishop_black we
would need two
instances of that Object So, defining an Object consists of a few things:
in a Chess game, right?
And eight instances of
obj_pawn_white. Get it? 1. We need to assign that Object a Sprite image so players can see it; this also gives it a
physical presence and size in the game.

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 7

2. We should give it some properties.


3. We can set what Events every instance of this Object must react to.
4. We can tell every instance of this Object how to react to Events; that is, what Actions
they must perform.

B. We need to create two Objects in Catch the Clown, a WALL and a CLOWN. Let‟s start with a
simple WALL Object. It‟s
simple because it needs no behavior at all; it does
not react to any Events.

To build an Object, go to the menu and select


Add and then Add Object (there‟s also buttons for all of these commands on the toolbar). The
following rather intimidating form appears:

Don’t panic! You‟re now at the operating table where you will work on the real „guts‟ of the game,
but it‟s not too scary once you use this screen a few times. Let‟s start by defining our WALL
Object…

1. Set the name to obj_WAL_INTIALSL. That‟s a familiar task. Remember use your initials
2. Choose the correct Sprite.

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 8

Remember, we previously defined all our Sprites; thus, they are now available to us – serving as
the graphic attribute as we define Objects in our game. Click on the little blue list selection
icon next to the words <no Sprite> and, from the pop-up menu that appears, select spr_WALL.
3. We want the WALL to be Solid; that is, we don‟t want Objects to pass through it. Simple check
the box labeled Solid. Then press the OK button and we are done with the WALL Object.

The CLOWN will be trickier because it has to do stuff in our game. However, we start to make the
CLOWN Object in the exact same way.

1. Add a new Object; change its name to obj_CLOWN; choose the correct Sprite. The CLOWN
Object does not need to be solid.
2. You know how to do all this from the WALL, but there is more to do for the CLOWN; we have to
specify its behavior, and for that we‟ll need to use more of this screen‟s functions.

2. Explaining the Object Properties Screen:


a) In the center of this screen is the Events box; it has three buttons beneath it:
Add Event, Delete, and Change.
In this box will go a list of all of the different Events that this Object must respond to in some
way.
Game Maker has many Events to choose from, but for this game you will only need a few.
b) To the right of the Events box is the Actions box. These are used to further define Events
by indicating what Action(s) take place when that Event occurs. These Actions are
organized by the little tabbed pages to the right and selected by clicking on the appropriate
icon representing that particular Action.
There are close to 100 different Actions that Events can trigger!
Holding the mouse over an icon produces rollover text naming / describing it.
I will give you a reference sheet to label.

Note, to select an Action, you don‟t left-click on the icon! You can either right-click on it
or click and drag it over to the Actions box; that Action will then happen when the Event
selected in the Events box occurs. Just pretend your reading this as you normally would
from left-to-right and you‟ll be fine. Watch…
3. First, we need to add a Create Event to put an instance of the CLOWN in play. When it
appears (the “Event”), we want it to start moving in a random direction (the “Action”
triggered by the Event).

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 9

Press the Add Event button below the Event box and the following
form appears:

We need a Creation Event, so click on the


Create button. A Creation Event has been
added to the Events box and it is automatically
selected (so that you to create the Actions
triggered when this Event occurs).
The Creation Event
It‟s not enough for an Next, left-click and drag the icon with the
instance of an Object to
be created and added to eight red arrows on the “Move” page on the
your game. It has to know right (“Start moving in a direction”) over to
what to do once it‟s „born.‟ the Actions box. That icon tells our CLOWN,
That is what we use the
Creation Event for; so when it is created (the Event), to start moving
these instances arrive (the Action).
„with orders‟ and get on
with their assigned duties
right away. Of course, you need to define “moving” a bit

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 10

more by letting the instance know how to move; thus, another pop-up menu appears,
as shown to the right. Most
game Actions require further definition, and
easy pop-up menus like this one allow you to do this.

For the moment, forget the box with the label Applies to; it applies to itself, but you‟ll
learn more about this later.

Below that, we can specify two key properties: the direction in which this instance will move,
and the speed it will travel. Because we want a random direction, click on all eight direction
arrows (but not the center square; that stops motion!). By doing this, you‟re telling that
instance to randomly select one of these eight directions.

Set the speed to „4‟ by tying in that number over the default value of „0.‟ So you know, „4‟ is a
nice speed; at higher values the CLOWN starts to go pretty fast.

Press the OK button to close this screen.

Now, scroll the mouse over the “Start moving in a direction” Action in the Action box. The
rollover text should read, “start moving in directions 111101111 with speed set to 4”. With that
confirmation, you‟re good to go. The Object Property window should look like this:

Oops! I made a mistake.


If you made a mistake with
an Event or Action, right-
click on it with the mouse to
receive a pop-up menu that
will allow you to manage that
item.
For example, you can we need a Collision Event when the CLOWN hits a WALL.
4. Now
choose Delete to remove it
(or press the <Del> key).
Again, press the Add Event button below the Event box, only this time select
You can choose Edit
Values to changeCollision
the from the pop-up menu (it‟s in the left column, next to the bottom of
properties of the Action
the list).
(double-clicking on the
Action does the same thing pop-up menu will list all of the Objects that you‟ve previously created
Another
– allowing you to edit).
for this game (in this case, the CLOWN and the WALL). Select the WALL
You can also dragObject;
these that‟s the one that we want to handle this collision Event.
items up and down their list
in order to change the order
in which they are „executed‟
(i.e., take place in the
game). Alan Emrich. tutorial
Game Maker tutorial 1 – Page 11

With the WALL collision Event selected (by default), it needs a Bounce Action to occur. (Remember,
we‟re in the Object Properties window for the CLOWN Object – we‟re telling each instance of the
CLOWN Object that, when it collides with a WALL, that CLOWN instance will bounce.) To do this, select
the last Action icon on the right showing an arrow bouncing off a WALL as shown to the right.
Right-click or click-and-drag it over to the Action box and a pop up window will appear (as illustrated
to the right).

Although there are values that you can adjust in this window (“Applies to” et al), the default values are
fine for our purposes here. We don‟t need precise bounces and we do want to bounce against solid
Objects (remember, we made the WALL a Solid Object by checking that box ). Press the OK button to
close this window. Again, you can scroll over the bounce Action in the Action box and look at the
rollover text to confirm that you have the settings right.

But wait, we have a sound for this bouncing Event, too! To include it, go to the tabs on the far right-
hand side of this window and select main 1. The icon you want looks like a speaker; drag it over to the
Action box. When the definition pop-up window appears (as illustrated on the left), click on the top
blue list selection icon and select snd_bounce. Are you seeing why we gave those files names that we
would easily recognize later? The second property is whether we want this sound to “loop” (play
continuously once it is started); we don‟t, so set leave the default value of “false” alone – that‟s what
you want. Press OK to confirm all this.

The Object Property screen should now look like this:

Collision Event summary: As you can see, there are two Actions that are both performed (in the
exact order listed, by the way) when an instance of the CLOWN collides with an instance of the WALL:
1) the CLOWN bounces (not precisely), and 2) the bounce sound is played. Do these „rules‟ that you‟ve
just „written‟ for the clown unit make sense to you?

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 12

5. Finally, with the Object Properties window, we to define a Mouse Event to occur to
add points to your score when you click on the CLOWN.
What‟s a „Left
Pressed‟ Mouse
Event? Again click on the Add Event button below the Events
box; choose the Mouse Event. Again a pop up menu
This Action will happen
only when the player appears with many choices to help you define exactly
presses the left mouse what kind of Mouse Event you are interested in. (Go
button on an instance of ahead and look at all of these powerful options for a
the Object. second.) The one you want right now is Left pressed.
Other Mouse Events
options can happen all We need three Actions to occur when the left mouse
the time while the player button is pressed on an instance of a CLOWN Object:
keeps the mouse
pressed or happen
independently from First, the player‟s score needs to increase. Game Maker
where the player automatically keeps and displays a score. To increase
presses the mouse the score drag the Action, go to the tabbed page (on the right) named score and drag
button. the three coins icon in the gray box (Set the score) at the top over to the Actions box.
The form shown on the right will appear:

Type in a „new score‟ value of „10‟ because that will


increase the score to 10 points. But setting the score to
It‟s all Relative 10 points every time you click the CLOWN isn‟t enough;
you want to add 10 points to the current score. You do
Many Actions have a
relative box that you that by checking the property „Relative‟ at the bottom.
can check to increase Press OK to close the form.
the current value of
something rather than
simply „set it‟ to a fixed
number. The next Action is to play the „click‟ sound. You can do this in
exactly the same way that you did the „bounce‟ sound (above). Do you
remember how? (main 1; drag the speaker icon over to the Actions
box; select snd_click, leave „loop‟ set to „false.‟)

Now, we want the CLOWN jump to a new random position when it is clicked on to increase the
gameplay challenge. Hey, this is an arcade game; you‟ve got to do stuff like that. Select the tab page
move. Conveniently, there is an Action that does exactly function. Drag the Action with the arrow
pointing towards the question mark (called „Jump to a random position‟) over to the Action box,
and the form shown on the right will pop up.

Lucky you! The default settings are fine, so just press OK to close this form.

Finally, it‟s not enough to send the CLOWN in a new direction; we also want it its speed to increase
just a tiny bit (as indicated in the Design Document). To ramp up the CLOWN‟S speed, we again use
the Action with the eight red arrows to set the motion. Once again, select all eight arrows by clicking
on them, but this time type a value of 0.5 (one-half) for the speed and click on the Relative box.

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 13

What this does is increase the CLOWN‟S speed by 0.5 every time it is clicked. Thus, the CLOWN
keeps getting faster and faster. The form should now look as follows:

That‟s it for the CLOWN Object. It gets created, it bounces off the walls, plus we score points
and it picks up speed when clicked on. Thus, we have defined Actions for the three Events that
constitute this game‟s core mechanic. Now it‟s time to press the OK button to close the form.

V. Creating the Room


At this point we‟ve scrounged up Sprites and sounds and have melded them into Objects that perform
prescribed Actions when defined Events occur. Whew! All that, and you haven‟t had to write a single
Get a Room line of computer code, just dragged and dropped Events and Actions to write the „rules‟ for the „units‟
In Game in your game. Game Maker really is a powerful game creation tool for the non-programmers among us.
Maker, the Now that we have created all of the game‟s Objects, there is just one more thing to do: create the
word “Room” Room in which the game takes place.
is just another
word for A. For most games, designing effective Rooms (often also called levels) is a time-consuming
“level.” task because it is here you have to find the right balance and progression in the game. That‟s why
there‟s a job in the game industry called „Level Designer;‟ it can be a pretty specialized field.
Fortunately, for Catch the Clown, only a single Room (level) is needed it is very simple to create.
You only need a walled arena with a single instance of the CLOWN Object inside it.
B. To create the Room, go to the Add menu and choose Add room. The following form (your level
design „canvas‟) will appear in the Room Properties window:

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 14

1. In the frame on the left side of the screen, you see the tabs for three different pages: Objects, settings,
and backgrounds. We‟ll only be using Objects at this time.
2. The majority of space (on the right) is the current Room (or „level‟). It appears as a grey area with a
square grid on it to help regulate the (set up) placement of Objects within it.

Because the Objects in this game are 32 pixels by 32 pixels, you‟ll need to change the size
of the grid squares.

At the top of this window are the Snap X and Snap Y values set to their default value of 16;
change these values to „32‟.
Note the change in the size of the grid squares; they‟ll not fit our Objects.
3. You‟re about to add the Objects you‟ve created to this Room. To do this, look at the bottom of the
frame on the left that is entitled, “Object to add with left mouse.” Currently, it‟s set to spr_clown.
Let‟s put the walls down first.

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 15

Click on the select item button to the right of spr_clown and select spr_wall from the pop-up
menu. You‟re now locked, loaded, and ready to place WALL Objects around the Room.

To add instances of a particular Object (in this case, the WALL Object), use the mouse to place
instances of the WALL in the cells along the edge (i.e., the border) of the Room. You might have to
enlarge the window or use the scroll bars to see the whole Room.
a) If you hold the <Shift> key while moving the mouse, multiple
instances will be added and you can ‘paint’ that Object around the
Room.
b) If you made a mistake you can use the right mouse button to delete
instances.
4. Finally, select the obj_clown initials Object and place one instance of it in the middle of the Room.
Your Room should now look like this:

That‟s it! Our one-and-only Room (level) is designed and ready. Close this window using the OK
button, which is the one with the big green checkmark at the left top of the form.

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 16

V. Creating the Room

Guess what? You‟re game is ready to be tested now! All of the requirements are in place: you‟ve
snagged Sprites and sounds and molded them into Objects for which they have defined Events and
Actions; a level has been build and populated with Objects, so now all of the minimum requirements
for a game exist. So let‟s save the game and test it!!
A. Saving the game is simple – it works like any Windows program. Go to the command line at the top
and choose File and then Save; select a location (your memory stick will do) and a file name (like
clown_1).
***Game Maker will automatically ennoble your file with the extension .gm6 (because you‟re creating
Game Maker version 6 file).

Note that you can not yet play this game; you‟ve only saved your file and that can only be viewed in
Game Maker. However, we can turn this file into a stand-alone executable that can be played in about
a second-and-a-half, but first let‟s test what we have to make it truly worthy of turning into a stand-
alone game file.

B. Testing the game is crucial. You‟re about to do some Gross Playtesting on your
design and, if you‟re satisfied with it, should then let others try it out and get
their feedback.

Testing (or even running the game in general) is easy. From the command menu, choose Run and then
Run normally. The design window disappears and the game will start (if you did not make any
mistakes). Try clicking on the CLOWN to if it‟s working right. After about 15 or so clicks, the CLOWN
is moving so fast that it‟s pretty hard to hit.

Note that you should be hearing the right sounds when the CLOWN bounces or your mouse clicks on it.
Also, the CLOWN should be teleporting around and changing to a random direction when you hit it.

To end the game, close the window or press the <Esc> key; that will take you
back to the Game Maker design window where you can make changes and
adjustments to your game.

It is at this point, when your game is still just a prototype and very malleable („easily changeable‟) that
you should be asking a lot of questions about the gameplay experience.

 Is the initial speed of the CLOWN correct?


 Is the CLOWN‟S speed increase too fast or too slow?
 Is the Room size right? Should it be bigger or smaller?
 Can you improve the Sprites or sounds selected for this game?

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 17

The beauty of Game Maker is that if you‟re not happy, it‟s very easy to make changes and test them out
in a matter of moments. Then you should seek out the feedback of other playtesters.

B. Creating a stand-alone executable file comes after you‟re satisfied that


the game is about where you want it and you‟re ready to show it to more people.
A „stand-alone‟ executable file is one that can be run without the need to have
Game Maker. You can send it others and they can start playing your game even though they don‟t
have a copy of Game Maker.

To create a stand-alone executable, from the command line at the top of the window, select File and
then Create executable, indicating where you want to save it and giving it a name. That‟s it. You can
close Game Maker if you like and simply run the executable file you created.

VI. Developing your game


Wave Goodbye;
“Hello, Midi.” Before you start spending the millions you‟ll make selling your copy of Catch the Clown, you
For background might want to beef it up a little. The game could use some finishing touches to make it more
music, don‟t use marketable.
wave files –
they‟re too large for A. Background music is a good place to start; it is very important and very easy to add in
this purpose. Game Maker. First, we need to add a sound resource to the game; it can be located in the
Instead it‟s better to same place that you found the other audio files (the Resources folder) and you can call it
use midi files. Midi
files are a different
snd_bkg initial (for Sound: Background).
way of storing music
and you can find lots In the Creation Event of the CLOWN Object, add another sound Action (see III.D. if you
of them on the
internet. forgot how) to play the background music. This time, set the property Loop to „true.‟ That
indicates that this sound file will keep repeating itself forever (which is the function of
background music).

C. A Background image would also spruce up your game.


Face it, the default grey background of the Room is boring. To create a background, you
need a new type of resource. Other resources that you‟ve already created are Sprites,
sounds, Objects, and Rooms. Now you‟re going to create a Background Resource.

From the command menu, select Add and then Add Background. You‟ll see a form that
is very similar to the Sprite form. Click the Load Background button within that
window and select the one so indicated in the Resources folder. The background form
will look like this:

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 18

“Tiling” the
Background Note that for background the property. Press the
Take a look at the two OK button to wrap up this screen.
check boxes below the
image file named: Tile
With that Background Resource defined, you have
Hor. and Tile Vert.
to place it in your game. To do that, open up your
They indicate that the
background must be Room Resource by double-clicking on its listing in
“tiled” horizontally and the left-hand pane of the main Game Maker
vertically; that is, window.
repeated to fill the
whole Room.For this to
work correctly the 1. Select the tab in the upper-left of this form
background image marked background. You‟re now looking, in
must be made such part, at this form on the right.
that it nicely fits against
itself without showing 2. First, uncheck the box labeled “Draw
cracks. background color.” You‟re throwing out the
Fortunately, many such default background color and will be plugging
images are available on
the internet. in your Background Resource.
3. Next, find the box that says “<no image>” and
click on the list button next to it. A pop-up
menu will appear with your Background
Resources listed; select your background file.
Suddenly, the Room background looks much
better.

D. After you play the game a while, you will notice that it is very easy because you know
exactly where the CLOWN is going. That doesn‟t have to be the case.

To make the game more challenging, let the CLOWN randomly change its direction of

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 19

motion from time to time. To this end you are about to learn the Alarm Clock Event.
Cool!

These „alarm clocks‟ tick down the time and, when they count down to 0, the Alarm
How Much Time Event it triggered. Each instance of an Object can have a maximum of eight different alarm
is in a “Step?” clocks set for it. Fortunately, we need just one for Catch the Clown.

Each step is 1/30 of a This is important


second. So, there are
30 steps in a second 1. In the Creation Event of the CLOWN instance, add a new Alarm Event. Thus, when the
and 1800 steps in a CLOWN is created, an alarm clock is created with it.
minute.
When you set this Use the tab page on the right hand side and select main2. Drag the Select Alarm
alarm clock to ‟50 Clock icon (in the upper-left) over to the Action box and a pop-up window opens up
steps,‟ that translates allowing you to set „Alarm 0.‟ Set the number of steps to „50‟ (which is about 1.5
to 1.5 seconds. seconds as explained in the sidebar box to the left; note that you can also change this
value in the settings tab in the Room Properties window). The screen should look as it
does below. If so, click OK and let‟s move on.

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 20

2. Okay, an alarm clock Action is set to take place 1.5 seconds after the CLOWN is
created, but what happens when it does? We need to define that by creating an Event for this alarm
clock and defining what its Actions are!

Click on the Add Event button below the Events box; select Alarm and, from
the pop-up menu that follows, Alarm 0. Now you‟ll see it as a listed Event in
that box, waiting to have its Actions defined. Okay, let‟s define what happens
when Alarm 0 goes off…

3. Click on the move tab. We‟ll set a new random direction of motion for the CLOWN by dragging the
Action icon with the red arrows (in the upper-left of the move page, Start moving in a direction) over
to the Action box. In its pop-up menu, click on all eight arrows and set the speed to „0‟ – be sure to
check Relative box! That means that the CLOWN‟S speed will not be changed by this Action.

4. But the way we have things now, this Action will only take place one time, 1.5 seconds after the
CLOWN appears at the start of the game. That‟s not enough; we want this Action to occur every 1.5
second. To do this, we have to add a housekeeping step – resetting the alarm back to „0.‟

To do this, another Action has to be added to the Alarm 0 Event. Once again, the tab page on the right
hand side and select main2 and drag the Select Alarm Clock icon (in the upper-left) over to the Action
box. Again, in the pop-up window, set „Alarm Clock 0‟ to 50 steps. That will create a „loop‟ where
this Action repeats the Alarm 0 Event every 1.5 seconds.

D. Finally, you should tell the players how to play the game and what the Object is; in other words, it is
time to write „the instructions.‟ Remember, Pong because the hit game that it was by having only one
instruction: “Avoid missing ball for high score.”

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 21

Game Maker has a standard feature for adding instructions to a game. To access this feature,
go to the command bar and select Add and then Change Game Information. A text editing
window appears and, in it, you can type in the information that player‟s will need (and edit
fonts, their sizes and colors, cut-and-paste – all that word processing goodness).

During the game this text is automatically shown when the player presses the F1 key (as with most
other programs). Alan Emrich is the resources for the sounds and graphics for this tutorial and the next

E. Your first game is ready!

Way to go. You‟ve learned a lot about Game Maker along the way.
You‟ll find that Sprites and sounds are important resources in any game editor. Also, in many of these, it
is useful to think in terms of game Objects that take Actions in response to Events.

Game resources folder in the T folder and internet.


They are ZIP drive

Alan Emrich. tutorial


Game Maker tutorial 1 – Page 22

Before starting the next tutorial, however, spend a little more time making some
corrections to Catch the Clown. Here are a few suggestions:
1. Have two CLOWNs in the game. This is extremely easy because you can place
multiple instances of the same Object in a Room.
2. Create new CLOWNS with different colors that are worth different points; the
ones that are harder to catch should be worth more than the easy ones!
3. Make a dark CLOWN that you should not catch because it will cost you points.
Set as negative points not positive – copy the original clown and change the
points
4. What if there was a wall section right in the middle of the arena?

Alan Emrich. tutorial

You might also like