Character moves using arrow keys
Character stops when colliding with wall
Character collects Treasures and gains points
Character collides with Door to move from room to room
Points are displayed
Health Bar drawn
Character increases health by picking up hearts
Splash start room created
10 rooms are created
Character can shoot to destroy monsters
5 different monsters are created
Monsters reduced Health
Boss monster moves
Boss monster shoots
Boss monster has health
Extra credit
Character can drop Bombs
Monster that comes alive when it gets close to you
Movable blocks
Monster Generators
Sprite Creation
Step 1
1. Open Game Maker 8
Step 2
Add Sprites for wall, character and treasure.
Click on Add Sprite Icon looks like a red pac man
Click load sprite and find the wall sprite.
Name the sprite sWall.
Repeat this process for your character and diamond.
Notes on sprites, sprites should start with "s",
Sprites can be found on the Internet I use 32x32 or 64x64 sprites. Game Maker also comes with some sprites in the tutorial section.
Sites to find character sprites
You can also draw your own sprites using Game Maker Image Editor you can create some nice pixel art characters
Step 3
Create your wall, character and diamond objects
Click on the Create Object Icon
Select the wall sprite and name the oWall
Repeat this process for you character and diamond
Make sure your sprites and objects start with the correct prefix s and o. This will make sure no naming conflicts arise.
Note: the wall object needs to have solid checked
Step 4
Create first room
Right click on the Rooms folder and select Create Room.
Change the Snap x and Snap y to 32 since we are using 32x32 sprites for our game.
Select the wall object and draw a perimeter wall around your room.
Select your character object and place it in your room.
When adding the wall hold down Ctrl+Shift to add paint the walls in room instead of one at a time
Step 5
Make your character move
We will now "code" using drag and drop to make your character move.
The object properties contains Events and Actions areas
Events
An event is a trigger, in other words it will trigger actions.
The game waits or listens for Events to take place. Example: the game is waiting for you to press the left arrow key or the game waits for your character to collide with a wall.
Actions
Actions are what you want the game to do when an Event takes place. Example: you press the left arrow key you character moves left or your character collides with a wall your character will stop moving.
Go to your characters object
Add a Keyboard event for Left, Right, Up and Down
Drag the Move Fixed into the actions
Select the correct direction that corresponds to your keyboard event
Select speed of 5 and make sure relative is NOT checked
Add a No Key Keyboard event
Drag in Move Fixed and select the middle no movement action. This will allow your character to stop when no key is pressed.
Step 6
Add character to room and test game
Double click on your first room to open it.
Add your character to your room
Click on the Run the Game button to test character movement
Press escape to exit the game
Step 7
Character stops when colliding with wall
Character moves through walls
Now you need to stop your character from being able to walk through walls
Open your character object
Add a Collision Event with the wall
Add a Move fixed action and select stop
Step 8
Create door to go to next room
Find a door sprite.
Create a door object
Now go back to your persons object give it a collision event with your door.
Drag a check next room action into collision event then a "Go to next room action"
Place the door in your first room
Step 9
Create a 2nd room
Right click on your first room and select duplicate.
Modify room 2 by adding more walls.
Test game to see if you can get to room two by reaching door.
Step 10
Collect Treasure to gain points
Open room 2 and place a diamond in it
Open your character object and add a collision event with the diamond.
Drag the Set score action into the collision event give it 25 points and check relative. By checking relative the 25 points are added to the point total
Drag the destroy Instance into the collision event and select other so the diamond will disappear once your character collides with it
Repeat this collision event for all the different types of objects you wish to collect for points.
.
Step 11
Create a splash start room
A splash screen is the first room that starts your game this serves several purposes.
It is a place to initialize or declare your global variables
It is a nice way to make your game look professional
It gives you options before you start a game like loading a previous game, high scores and credits.
Right click on your room folder and create a new room.
Name the room rm_start
Now we create an object named oStart
Add a create Event
Add a set health to 100 and a set score to 0 actions
Add a Next room action third
Add this object to rm_start (This object does not have a sprite)
Make sure your rm_start is the top room so that when the game start you enter it first
Step 12
Open your Character
Add a Draw Event with a draw self action
Draw Health Bar check relative
Add a Draw Draw Event with the following actions:
Set color to white
Draw Rectangle filled
Set color to black
Draw Score
The Draw rectangle should have these settings
The Draw Health bar should have these settings
Step 13
Restart Game when HP runs out
Restart game when HP runs out
Open your character
Add a event
No More health
Add these actions
Show High Score
Restart Game
Step 14
How to Increase Health
Make your character increase health by collecting hearts
Create an Object with a heart sprite.
Go to your persons object and add a collision event with the health object.
Drag a destroy instance of other into the collision event.
Drag the Set health action into the collision event and give it a value of 100
Step 15
Make 10 or more progressively harder rooms
Make 10 levels start very simple with only a door in the first room.
Room 2 will introduce 1 treasure.
Room 3 will have a monster.
Continue to design rooms with more and more challenges and rewards.
Name each room by going to the settings tab in your room
Add a name and a caption that describes your rooms
You can change the background of each room if you like.
Hint: Once you make one room you can duplicate it by right clicking on your room and select Duplicate. This will save time since you won't have to redraw the perimeter walls of your rooms or put in your controller, door or character.
You can make rooms larger by going to the settings tab and changing the height and width.
Step 16
Room Backgrounds
Room design is next. We will start with a background. A background is used as the ground you walk on. So you need to decide if you want a desert, grassland, mountains, ice or whatever. I have several to choose from here.
Right click on the background folder and add a background image from one of the above name is bg_grass.
Open your room folder and go to the background tab
Select the background to use for your room
Earth
Grass
Sand
Stone
Mist
Step 17
Adding Fog to a Room
Adding fog or mist to your room is easy.
Save the mist image from above the image is there just hard to see
Create a background of the mist
Go to your room and select the background tab
Click on Background 1
Choose the mist as the background
Select visible when room starts and foreground image so it will be on top of everything else
Select 1 for Hor. Speed and Vert. Speed this will make the fog slowly move adding to the visual effect.
Step 18
Adding Tiles to Room
Now we will use tiles to make your rooms look better to do this we will use tile sets. Tile sets are similar to backgrounds except they are split up into individual pictures from the background.
To create a tileset right click on the background folder and create a background
Select use as tileset you then have to match the tile size with the tile set most are either 16x16 32x32 or 64x64
We will use this as an example
This tile set can be used for stone paths in your world. It will be split up into 32x32 tiles these tiles all fit together seamlessly to create nice path
To place a tile in your room go to the tiles tab then select the tile you wish to place in your room and place it. Continue to place tiles to make your room look nice. You will have to add many tilesets to get the variation you want. You can look on the Internet for many more tilesets.
You should place some of the following types of tiles in each of your rooms:
Trees
Paths
Flowers
Rocks
Buildings
Stumps
Fences
Signs
Etc
Here is good free resource for tiles
Step 19
You need to be able to defend your self from monsters. So you will throw rocks.
Create a round sprite for your rock 16x16 in size or choose something to throw like a knife or fruit (You can edit the size of any sprite by choosing edit, transform, stretch)
Create an object with that sprite name in oRock
Add a Create Event to the rock object
Add a Move Towards action
x = mouse_x
y= mouse_y
speed = 15
Relative not checked
Add a Other Views Outside View 0 Event
Add a destroy Instance of Self action
Step 20
Now that we have made our rock it is time to make your character thrown the rock. We are going to use mouse shooting to give your character precise aiming of your bullets.
Open your characters object
Add a Global Left Pressed Mouse Event
Add a Create Instance of your Rock
x = 0
y = 0
relative checked
Step 21
Monster #1 Side to Side
The easiest monster to make is a side-to-side moving. It simply patrols back and forth.
Create a sprite for your statue use this one if you want
Call this sStatue
Create an object for this sprite and call it oStatue
Now add a Create Event and add a Move Fixed action select right and left and give it a speed of 2
Add a collision event with the oWall give it a reverse horizontal action.
Step 22
Monster #2 Up and Down
Another easy monster to make is a up/down moving.
Create a sprite for your skeleton use this one if you want
Call this sSkeleton
Create an object for this sprite and call it oSkeleton
Now add a Create Event and add a Move Fixed action select up and down and give it a speed of 3
Add a collision event with the oWall give it a reverse vertical action.
Step 23
Monster #3 Moves Diagonally
One type of monster is one that moves diagonally. This monsters erratic movement makes it hard to sneak past in tight corridors.
Create a sprite for your spider use this one if you want
Call this sSpider
Create an object for this sprite and call it oSpider
Now add a Create Event and add a Move Fixed action select the 4 corner movements and give it a speed of 4
Add a collision event with the oWall give it a bounce action.
Step 24
Monster #4 Randomly through Maze
Now we will make an object that will move randomly through your maze you can never guess which way this monster will go making it hard to predict a safe path to the door.
Create a sprite for your bat use this one if you want
Call this sBat
Create an object for this sprite and call it oBat
Now add a Create Event and add a Move Fixed action select the left right up and down directions and give it a speed of 5
Add a collision event with the oWall add move fixed action and select the same for directions.
Every time this monster hits a wall it will randomly choose one of the 4 directions to travel next.
Step 25
Monster #5 Chases you through Walls
The ghost can travel through wall but it slows down whenever it hits a wall. It can sense where you are located so it is always trying to get to you.
Create a sprite for your ghost use this one if you want name it sGhost
Now create an object for your ghost name it oGhost
Give is a Step step event
Drag the Check Collision action into the step event check relative
Drag a Move Toward action and for the x value type your characters name with a .x after it do the same for y but put a .y after your characters name
select .5 speed
Drag in an Else Action
Drag in a Move Toward action and give the x and y values the same as the other Move Toward action
select 3 speed
Step 26
Make Monsters Hurt you
We want the monsters to hurt you so open your characters object
Open your characters object add a collision event with the monster and drag a set health action give it a value of -10 and check relative (you can make the monster take away different amounts of health)
Now drag in a destroy instance and select other so the monster will disappear
You need to add this for all the monsters that can hurt you
Step 27
Make Rocks Hurt Monsters
Your rocks need to destroy the monsters here's how we do it
Open your monster objects and add the following to all of them.
Add collision event with oRock
Add a Set Score Action and set score to 25 and check relative.
Add a destroy instance of self
Add a destroy instance of other
Step 28
How to Make Boss Monster
We want to create a Boss Monster that moves, shoots and has health
If you want to use a moving sprite for your boss use the below image if not find another sprite for your boss.
If you want to make your boss sprite move you can use the sprite above and follow the instructions below.
This type of picture is called an XP style sheet because it contains 4 poses.
Game maker does not automatically use the XP style sheet we have to convert it to 4 different poses
Click on Add Sprite Icon click load sprite and then select Edit Sprite
Select File Create from Strip and load your character.
Number of images and number of rows is 4
Image width is found by dividing the total width of the tile sheet by 4 so the green dragon is 384/4 so each should be 96
Image height should be 96 as well since the image is 384 px x 384 px
Click OK
If your character has a colored background select Image Erase a color to make it transparent.
Save this as the correct pose name sBossD, sBossU, sBossR, sBossL
To get the second pose change the vertical pixel offset to 96 for pose 2 when the dragon is facing left.
Step 29
Make Boss Move
We want your boss to move left and right to guard the treasure.
Lets make your monster move left and right.
Open your monster object and add a create event
Add a Move fixed action and select left and right at a speed of 2
Add a collision event with wall and add a reverse horizontal direction action
Now put your Boss into a room to make sure it moves
Step 30
Make Boss Shoot
We want your boss to fight back we can use this sprite for the fireball
Now lets make your boss shoot to do this we need a boss bullet
Find a boss bullet sprite and make it into an object I will use a fireball sprite
In your boss bullet Create a collision event with the wall that destroys boss bullet
Create another collision event with your character that takes away a life and restarts the room just like the other monster collisions
Now we need to make your boss shoot the fireball
Add a Step step event to your boss
Add a create moving instance to your Step Event
Set object to boss bullet speed to 20 and check relative
Type 270 for the direction
By the way game maker handles directions using degrees of a circle so 270 is down 0 is right 90 is up 180 is left.
This will make your monster shoot an endless stream of bullets so we need to make the firing random as well
To do this add a Test chance action to your monsters step event and give it a value of 30
Step 31
Draw Health Bar for Boss
Now we want to draw a health bar on the boss
Add a create event for your boss
Add a set variable name it HP action and give it a value of 100 don't check relative
Add a Draw Event to your boss
Add a draw variable action name HP x=0 y=-32
Step 32
Make Rock hurt Boss
Now we want your rock to hurt the boss
In your boss object Add a collision event with the rock
Add a destroy instance of other
Add a set variable give it a value of -5 and check relative
Now add a test variable hp to the step event text in less than 0
Add a bracket
Add a destroy instance of self
Add a set score and give it 1000 points check relative
Add a closing bracket
Step 33
Make Boss Sprite Change as direction changes
We want the sprite of the boss to correspond with the direction traveling. To do this we will use a in game variable called direction
Go to the Draw event of you boss and add a test variable
variable = direction
value = 180
operations equal to
Now add a draw sprite and select the BossL sprite since 180 is the left direction
Now add another test variable this time with a direction of 0
Now add a draw sprite and select the sBossR sprite since 0 is the right direction
EXTRA CREDIT DIRECTIONS
Extra credit
Character can drop Bombs
Monster that comes alive when it gets close to you
Movable blocks
Monster Generators
How to Make Bombs
Create Bombs to destroy Monsters or Walls
Find a sprite for a bomb and an explosion and create objects for them.
Edit bomb sprite to make it turn red
Double click on the bomb sprite and select Edit Sprite
Click Animation then select Fade to Color
Select Red color
Type 30 for the number of frames
Click OK
Now click Center to make the explosion come from the center of the sprite
Click OK again.
Make Bomb turn into Explosion
Open the bomb object
Add Animation End Event
Drag destroy instance of self into the action
Drag Create Instance of Objectand select the explosion as the object you will create
Select relative so the explosion will appear in same spot as bomb
Make Explosion Destroy Self
Open explosion object
Add Animation End Event
Drag destroy instance of self into the action
Make Explosion kill Monsters
Open your monster objects and add the following to all of them.
Add collision event with explosion
Drag the Set Score Action and give it some points and check relative.
Drag destroy instance of self into the action
Make your Character place bombs to destroy enemies
Open character object
Create a Key Press Event
Select the B key (or any other key you want to use to drop the bomb)
Drag the Create Instance Actioninto the event and select bomb as your object check relative
Monster that comes alive and chases you when you get to close
I like to use two sprites one for the resting monster one for the chasing
This is a cool monster that will follow you but only when you get close enough to wake the monster
To make this monster you must you code
First make a monster and another monster that will come alive when you get close to it I named my resting monster oRest and oChase
Add a step event to the waiting monster
The add Execute code
Copy the following into the code and change the names to your monster names
This code changes your waiting monster into a chasing monster when your guy get within 100 pixels
Text Box
if (distance_to_object(oPlayer) < 100)
{
instance_change(oChase,1)
}
Chasing Monster
The monster that is created will not move yet so we will solve this problem
Add a step event to your oChase monster
Drag in a Move Toward action and change the x and y values to the name of your character followed by a .x for x and a .y for the y.
Add a collision event
Movable blocks
We want to create blocks that can be pushed by your character. This will allow you to design puzzle rooms. The blocks need to have the following attributes.
Push-able left, right, up and down
Here are the directions:
Create a sprite and object for your push-able block.
Make the block solid
Add a Step step Event to the Push Block
Add an Execute Code action and copy the following code.
Text Box
if (place_meeting(x-5,y,oPlayer) &&keyboard_check(vk_right))
{
x+=5;
}
if (place_meeting(x+5,y,oPlayer) && keyboard_check(vk_left))
{
x-=5;
}
if (place_meeting(x,y-5,oPlayer) && keyboard_check(vk_down))
{
y+=5;
}
if (place_meeting(x,y+5,oPlayer) && keyboard_check(vk_up))
{
y-=5;
}
In the code make sure the speed and the check are the same speed that your character moves or the block speed will not match your players speed
Now we need to make the block stop if it collides with a wall or another push-able block
Add Collision events for each block
Add a Move fixed action and select stop for each collision event
Monster generators
Making a monster generator is a cool way to make lots of monsters in a room
Make an object for your monster generator call it oMonstergen
Add a create event to it
Drag in a Set Alarm action and give it 60 steps, 30 seconds = 1 second so this generator will produce a new monster every 2 seconds
Now add an Alarm event and drag in two actions
Create instance of oGhost check relative this is the monster it generates
Now drag in a set alarm and give it 60 steps this will restart the alarm