You are on page 1of 9

MAKE YOUR FIRST A-MAZE-ING GAME

IN GAME MAKER 7
In this tutorial, you will learn how to create your first game in
Game Maker. The game you will create will be a simple
maze game. The object of the game will be for the player to
move through the maze to reach the end point.

In this example, the player is a Princess and the end point is


the Castle. The maze walls are made up of hedges. This
game is available for download in the Game Maker Tutorials
section of the Games in Learning website at
www.gamesinlearning.com.

Creating the rooms for your game

We are going to start by setting up the rooms in the game. A


room is like a level or scene in a game. We will be adding three rooms. These will be the:

Title Room - which we will name rm_title


Maze Room - which we will name rm_maze
Game Over Room - which we will name rm_gameover

To create each room we follow this process.

1. Select the Create a Room button on the toolbar.

2. In the Room Properties panel that appears, select the settings tab and
name the room. Use the names specified above as a guide to what you
will call your rooms.

3. In the Caption for the room cell, type in a caption for your game.
This will appear at the top of the game

4. Select the green tick in the top left hand corner to save your room.

Repeat this process until you have set up three rooms. These will appear in
the rooms folder in the Resource Explore window at the left of the screen.
Your rooms folder should look like the one shown here on the right.

Creating the sprites for your game

When you want to create a character or object for your game, you need to first create it as a sprite and
then make it an object. Think of a sprite as the visible part of an object. You will understand this
better as you work through the next steps.

We will need to set up three sprites for the game. In my game, these will be the following. You may
however wish to have a different context for your game. Just say your player will be represented by a
ghost rather than a princess, simply change the name from spr_princess to spr_ghost and so on.

The Princess sprite - which we will name spr_princess


The Hedge sprite - which we will name spr_hedge
The Castle sprite - which we will name spr_castle

To create each sprite, follow this process:

1. Select the Create a Sprite button on the toolbar.

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 1 of 9
2. In the Sprite Properties panel that appears,
enter the name of your sprite.

3. Ensure that there is a tick in the box next to the


text Precise collision checking.

4. Select Edit Sprite to draw and edit your sprite.


Note that sprites can also be loaded into Game
Maker. These can be images created in other
graphics applications or sprites you have used
in games you have previously developed. You
can also find resource kits of sprites on the web
that you can download and use in your game.

5. Double click on the green square that


appears. This will take you into the
image editor where you can draw your
sprite.

Before you start to draw your sprite in the Image Editor, here are a few tips:

Tip #1 The size of your canvas where you will draw your sprite is set by default to 32px x 32px.
This is a good size for tiles and objects within the game screen which is currently set at
640px x 480px. However, you may want to create sprites for characters and objects with
different sizes. To change the canvas size so you have space to draw bigger objects and
characters, select Transform from the menu and then choose Resize Canvas.

Tip #2 The checkbox labeled Transparent (shown above) indicates whether the rectangular
background of the sprite image should be considered as being transparent. Most sprites are
transparent. The background is determined by the colour of the leftmost bottommost pixel
of the image. So make sure that no pixel of the actual image has this colour.

Tip #3 It’s a good idea to use the Zoom In and Zoom Out tools when drawing and
editing your sprite. By doing so, it will be easier to see what you are doing and
you’ll be able to create sprites with more detail.

Tip #4 You can make your sprite an animation by adding


additional images. We won’t be covering animation in
this tutorial, but you can access the Help menu to learn
how to do this.

6. In the image editor design your sprite. My princess sprite is


shown here. Note that the canvas size is still 32px x 32px. I
have just zoomed in to be able to see what I was doing.

7. Once you are happy with your sprite, select the green tick button
in the top left hand corner. This will take you into the Sprite
Editor panel, select the green tick again to return to the Sprite
Properties panel. Once there, select the OK button at the bottom.

Repeat the process outlined in steps 1—7 until you have set up all
three sprites for your game. Note that the sprite you will use for the
wall of your maze will need to be the same size 32px x 32px. You will
place multiple copies of this sprite / object when you make
the walls of your maze in a later step. When you have finished
designing the sprites you need for your game, the Sprites Folder in
the Resource Manager window should look like the one shown here.

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 2 of 9
Creating the Objects for your game ABOUT OBJECTS
You have just created the sprites for the game. A sprite is an Objects are placed in rooms within your
image that can be used to represent an object. In this next game. They are the main features of
sequence of steps, you will set up the objects for the game. your game and can include game char-
acters, inventory items, walls and mov-
Before you start working through the steps below, learn about ing objects. When you create and edit
objects and how they work in Game Maker by reading the box an object, you can select if it should be
to the right. visible or invisible, moving or static or
solid or not solid. Objects can be set up
To create the object for your main character in the game, follow to move and react to input from the
these steps. player and other objects. Things that
happen to objects are called events.
1. Select the Create an Object button on the toolbar. Every time you place an object in your
game, you place an instance of that ob-
2. In the Object Properties panel that appears enter the ject. For example, if you create an ob-
ject called tree and then place multiple
name for your object. The name I have entered is
copies in your room to create a forest,
obj_princess, however yours could be something like
each copy of the tree is an instance.
obj_ghost, depending on what your main character is.
Note that the use of the prefixes obj, spr and rm are just
designed to help us identify what type of item we are dealing
with. When creating programs or games, it is common
practice to use conventions like this.

3. Select the sprite that will represent your object by clicking


on the Sprite Selector button and choosing the sprite
from the drop down menu that appears (shown here).

4. Click on the box next to the word Solid to make your


object solid.

5. Select the OK button at the bottom of the panel.

To create the object that you will repeat for the wall of the
maze, follow these steps.

1. Select the Create an Object button on the toolbar.

2. In the Object Properties panel that appears enter the name for your object. The name I have
entered is obj_hedge.

3. Select the sprite that will represent your object by clicking on the Sprite Selector button and choosing
the sprite from the drop down menu that appears (shown here).

4. Click on the box next to the word Solid to make your object solid.

5. Select the OK button at the bottom of the panel.

To create the object that you will use for the end point in your maze, follow the same steps. In my game,
this object is obj_castle.

Once you have set up all three of your objects, the Objects
folder in the Resource Manager window should look like this.

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 3 of 9
Putting your objects in the rooms

We are now going to place the objects you have created in the room containing the maze. Follow these
steps to do this.

1. Double-Click on the rm_maze room in the Rooms folder in the Resource Manager.

2. In the Room Properties panel that appears, select the Background tab and
then click on the box containing the colour to select the colour you
would like for your background. Note that you can use images for your
background, however in this tutorial we are only using a solid background
colour.

3. Now set the values of the SnapX and SnapY


cells to 32.

4. We are now ready to place our objects in the room.


To do this, click on the Objects tab in the Room
Properties panel. One of your objects will be
displayed in the left section of the panel. To select
a different object, simply click on this object and a
menu will appear which will let you switch between
objects.

5. Prior to adding objects into the room, select the


maximise button to maximize the window so
you can see the entire area of the room.

6. Now select the object you want to add and click on the room to add
the object. If you put the object in the wrong spot, simply right
click on it to remove it from the room. To add multiple copies of
an object to the room quickly, simply hold down shift whilst clicking
and dragging. This is the most efficient way of adding the walls of
the maze. Once you have added the objects to your maze room,
you should have something like the image to the right.

Adding text to a Room

We are now going to add some text to the other rooms in


our game - the Title room and the Game Over room.
Adding text in Game Maker requires a few steps. These
are outlined below.

1. Now when you add text to your game in Game Maker, by default the font is set to
Arial and the size is 12pts. You will most likely want to use a larger and more
interesting font for the text in your Title and Game Over rooms. To do this, we
need to add a font.

To do this, select the Create a Font button from the toolbar at the top.

2. In the font panel that appears, select the font you would like to use for your
text, give this font a name such as fnt_main and increase the size of the font.
Select the OK button at the bottom. On a piece of paper, make a note of the
font and size you selected as you will need this info in a later step.

Note that this font will now appear in the Resource Manager panel in the fonts
folder. This means it will be loaded into your game and can be used when
creating the sprites for your text in your next step.

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 4 of 9
3. Create a new sprite by selecting the Sprite button (shown here).

4. Name this Sprite spr_titletext

5. Select Edit Sprite to enter the Sprite Editor. Double click on the green box to enter the Image
Editing Panel.

6. You won’t fit much text in the default image size of 32px x 32px, so
select Transform > Resize Canvas. In the Resize Panel that appears
(shown to the right), change the width to 300 px and the height
to 100 px. You will need to uncheck the Keep aspect ratio box to
do this. Select OK.

7. Select the Text menu from the top menu bar and select Font.
Choose the font and font size you set up in the previous step. Note
that you can select any font on your system, but that they only work
in your final game if you have set them up as a font using the Create
a Font tool.

8. Select the Draw Text button from the toolbar at the left of the
Image Editing Panel.

9. Enter your text in the Drawing a Text box that appears. Select OK.

10. Move your mouse over the text you have added and drag the text into
the position you want it to be in.

11. When you are happy with the text, select the green tick in the Image Editing panel. Then select
the green tick again in the Sprite Editor panel. Your text is now in a sprite that can be added to
an object to display in the Title Room.

12. Select the Create an Object button to create the object for the title text.
Name this object obj_titletext and select the sprite you just made
containing the text. Select OK from the bottom.

13. Double click on the room name rm_title to open the Title Room.

14. Select the Background tab and then select a background colour for this
room.

15. Select the Objects panel and select the title text
object obj_titletext. Add this to the stage.

You may wish to add some other objects to the


room to enhance the look.

At this stage, you have added some text to only the Title
Room in your game. You should now take some time to add
some text to the Game Over room. You may also want to add
additional text to the Title room.

To do this, work through the same steps. Remember to create


any fonts you need, make the sprite for each bit of text, create
each object and then add the text objects to the room. It
seems like a lengthy process, but once you have been using Game Maker for a while, it doesn’t seem as a
bad. Once you’ve added all your text to the game, move onto the next page of this tutorial.

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 5 of 9
Adding a Start Button to your game

We have nearly set up all of the elements of our game. However, at this stage, if we played the game,
you would only be able to see the Title room. You would be stuck on this page as we haven’t added a
button for the user to click to move onto the main game area, the room named rm_maze.

We need to create a start button for your game. To do this,


Create a Sprite and name it spr_start. Then select the
Edit Sprite option and go into the Image Editing panel and
draw what you want your button to look like.

You will then need to Create an Object and set up the object
for the start button. I named this object obj_start. Once
you have done this, add the object to your Title Room.

Your game should now look something like this.

Adding the Events and Associated Actions to your game

At present, the rooms in your game contain no interactivity.


Even though we have added our objects, nothing happens
when you play the game. You can see this for yourself by running the game. To do this, select the
run button in the main toolbar.
Once you have tested the game, click on the red cross in the corner to close the game window.

In Game Maker, the main way that you add interactivity,


is by adding events and actions to the objects you create.
The steps below and on the following page, will lead you
through the steps you need to follow to make your game
playable. Whilst working through these steps, you are
encouraged to click on the different tabs in the Object
Properties panel. You should then roll your mouse over
the different actions available to begin to become familiar
with the types of actions that you can add to your game.

Let’s get started adding the events and actions. To begin


with, we are going to add and event and action to the ob-
ject containing the Start Button.

1. Double click on obj_start in the Resource Manager.

2. Select the Add Event button to see the


Event Selector menu (shown here).

3. From this menu, select Mouse > Left Button. This will
mean that the action we set in the next step will occur when
the player places their mouse over the Start button object
and presses the left mouse button.

4. We are now going to add an action that will take the player
to the next room when they click on the button. To do this,
select the main 1 tab from the collection of tabs on the
right hand side of the Object Properties panel (as circled).

5. Click on the Next Room button (shown here) and


drag it into the Actions section of the panel.

Test your game by clicking the Run button. You should now be
able to click on the start button and move to the maze room. If
not, check the order of your rooms in the Resource Manager and reorder if needed.
A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 6 of 9
Adding Events and Actions to the Main Character

It’s now time to add the main interactivity to the game. To do this we are going to add five events and
associated actions to the character object.

1. Double click on your main character object from the Resource Manager window e.g. obj_princess.

2. Select Add Event from the Object Properties panel that


appears. Then choose Keyboard and <Left>. This will
mean that the action that we set up in the next step will work
when the player presses the left arrow key on the keyboard.

3. Make sure the move tab is selected and click and drag
the Move Fixed action into the Actions Panel.

4. In the Move Fixed properties panel


that appears, click on the left arrow
to make it red. This will make the
object move left. Set the Speed to
3 and select OK.

You have now set up that your character


will move left when the player presses the
left arrow on the keyboard.

You will now need to add the additional


events in to make the character move
right, up and down when the other arrows
are pressed.

To do this, work through steps 2 - 4 again


for each other direction. Make sure you
select the correct arrow to match the key-
board key event you set up.

If you test your game now, you’ll see that you can make your character move by pressing the different ar-
row keys. The problem is that your character walks over the top of the walls of your maze.

We need to add a Collision Event and a Move Fixed Action to prevent this
from happening. To do this, follow these steps:

1. Select the character object again (obj_princess) and in the Object


Properties Panel, select the Add Event button.

2. Select the Collision Event and from the drop


down menu that appears, select the obj_hedge
object or the name of the object you have
created for your walls.

3. Select the Move Fixed action again and drag


the action into the Actions panel.

In the Move Fixed panel, select the Stop


button in the centre of the arrows. Leave the
Speed at 0.

Test your game, you will now be able to move your player around the maze.

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 7 of 9
Adding the Final Interaction

The last action we need to add to our main character is the action that will take the player to the Game
Over scene. To set this up, we will add one additional event and action to our main character object.

1. Double click on your main character object in the Resource Manager window (e.g. obj_princess).

2. Select Add Event and choose the Collision event. From the
drop down menu, select the object you have created to be your
end point. In my game, this is obj_castle.

3. You are going to add a Next Room action to this event. To


do this, select the main1 tab from the collection of tabs on
the right hand side.

From the collection of actions in the main1 tab, select


and drag in the Next Room action. Your panel
should now look like the one to the right.

Adding the Final Object and Interaction

Test your game now and see what you think. You should be
able to click on the Start button in the Title Room (rm_title) and
then move your character around the maze in the Maze Room
(rm_maze). When your character reaches the castle or the
end point of the maze, you should be taken to the Game Over
Room (rm_gameover).

Have you worked out what’s missing? It’s a button to allow the player to start again. After all, it’s such a
great game, they’ll most likely want to. Ok, well I guess it’s not going to win any Game Development
Awards, but it is your first game, so you should make it fully functional.

So it’s time to add the Start Again or Replay button. You will need to design the sprite for this button,
create the object for the button and then add the correct event and action. I’m not going to show you
how to do this, because you should know what to do by now. However, I will give you a hint, there is
another action in the main1 tab that allows you to specify which room the player is taken to. It is called
the Different Room action. When you drag this into the panel, you’ll be able to choose the room you
want the player to be taken to.

Adding some Background Music to your game

Your game is now playable, but it could be enhanced with the use of some sound. In the steps below, you
will learn how to add sound to your game.

1. Select the Create a Sound button from the main toolbar.

2. In the panel that opens give your sound a name e.g. snd_bgmusic and
then select Load Sound. Select a sound file from your computer.
Game Maker can use wav, midi and MP3 sound files. Note that you can
get a large number of free sound files off the web. A good place to get
sound files from is the loops section of the Flashkit site at
www.flashkit.com.

3. In the Kind options, select Background Music. Note that you can also
select Normal Sound for sounds you want to play on events e.g. when
the Princess runs into the Hedge.

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 8 of 9
Even though you have created a sound for use in your game, it can’t be heard in the game until you attach
it to one of your objects. Complete the following steps to get it working.

1. Double click on your main character object (e.g. obj_princess) to open the Object Properties
panel.

2. Select the Add Event option and select Create. The Create event launches the attached action
at the time in which the object it is attached to appears in the game. In this case, we will be attaching
the sound. This will play when the Maze Room is reached as this is the first point in the game where
the Princess or main character appears.

3. Select the main1 tab and from the action collection, select the Play Sound button
and drag it into the Actions area.

4. In the panel that comes up, select the button


next to the Sound cell and select your
sound from the drop down menu that appears.

Test your game to hear the sound. Notice how it


begins playing only when your main character
appears.

Saving and Publishing your Work

Now you should have been saving your game whilst working through this tutorial. I didn’t remind you
because it’s something you should regularly do regardless of the application you are working in.

Saving your game

It’s now time to save your final game. To do this select File > Save. Give your file a name if you
haven’t done so already. This is the file that you can reopen in Game Maker when you want to edit or
enhance your game.

Publishing your game

Your final step is to make your game a standalone application - a game that can be played on any PC,
regardless of whether Game Maker is installed. To do this, select File > Create Executable. This will
allow you to save your file in .exe format. To play your game from this file, simply open the .exe file in
the location you have saved it. You will see that your game opens in it’s own window. It is now ready to
share with friends.

You’ve done it - You’re now a Game Maker!

If you’ve got to this point—you’ve created your first game in Game Maker. This tutorial was designed to
introduce you to making games in this application and to help you develop an understanding of the Game
Maker basics. You should be able to take what you’ve learnt and apply it in a different game context.
Remember that one of the best ways to learn is to click around, roll over and explore the different events,
actions and features in the program.

If you’re ready to take on some other tutorials, head to some of the following websites:

Game Maker Tutorial Collection at the Games in Learning Project Website


www.gamesinlearning.com

Official Game Maker Tutorials


http://www.yoyogames.com/make/tutorials

A Games in Learning Project Tutorial - www.gamesinlearning.com - Tutorial by Kristine Kopelke - Email kkope1@eq.edu.au
Page 9 of 9

You might also like