Gameolosophy > Games

Make Your Own Maze Game with Game Maker

(contd.)

Page 3 of 5 | «Prev12345Next»

Now your character will move (as long as he is aligned with the grid) whenever you press a direction key, and stop when no key is pressed. Now is an ideal place to save your game. Now you can press the green play button to try out the game. Once it loads you'll see you're able to move your character about. But it's not a very good game yet, since you can't interact with anything. Close your game by clicking the close button in the top right or by pressing escape, and go back to the Game Maker window. It's time to add some interaction.

Double click on 'obj_character' to bring up his properties window again, and this time add a new event 'Collision' and select 'obj_block'. Now in the events box, stop him moving (use the same 'Start moving in a direction' icon and set it to the same preferences as in the No Key event) and snap him to the grid (32x32). So in English this means: when your character collides with a block, he stops and is snapped onto the grid. Snapping him onto the grid is an important step, otherwise he might end up stuck off the grid (and our movement is set up so that he can only move when he is correctly on the grid). We don't want him to get stuck inside a wall.

At this juncture it's probably a good moment to save your game and then click the green play button so you can see your character interacting with the walls. As an aside: I found when I did this that my character was bouncing about when I tried to walk into walls to the right of me. I fixed this by going back to my sp_character properties and unticking 'precise collision checking'.

Now close your game and go back to the Game Maker screen. It's time to add a points system and make gems collectible. Open up 'obj_character' properties again and create a new event. This time select the 'Create' event. This event is activated when the object is first created (ie. at the beginning of the game in this case). Under the 'Control' tab drag and drop the VAR ('Set the value of a variable) icon into actions box. For the Variable enter: 'var_gems_collected' and for the value enter: 0 (zero). Leave the 'Relative' checkbox unticked.

A variable is like a box that stores information. In this case we created a variable called 'var_gems_collected' and we will use this variable to store a count of the number of gems collected. By putting this in the create event we are initializing the variable at zero.

Next in the 'create' event we want to add another action, this time go to the 'Score' tab and drag 'Set the Score' into the actions box. Set the score to zero as well. So we have initialized both to zero at the beginning of the game. You could also add the lives to initialize that as well while we are here. Except in the case of lives you may want to initialize it to 3 or more.

Now (still in your 'obj_character' properties) add a new event. This time add a collision with 'obj_gem'. Then drag the following actions into the actions box: (from the score tab) 'Set the score' and set it to 20 then make sure the relative checkbox is ticked. The relative checkbox means that it will take the existing score and add 20 to it. Then from the 'Control' tab select VAR and drag and drop it into the actions window. Type in 'var_gems_collected' and for the value put in 1 then tick the 'Relative' checkbox. This means that every time you collect a gem the count will go up by 1. Finally under the main1 tab drag the 'Destroy the instance' icon into the 'actions' box and select 'applies to: other' which means that the gem will be destroyed (ie picked up) when the character moves over it.

Now save and try out your game!

Now it's time to add some more spites and some sounds. Firstly we'll be needing some kind of goal to try and reach through the maze. Upon reaching the goal we'll be taken to the next level. Secondly let's add a bonus object that we need to collect to progress to the next level. Thirdly lets add a switch and some dynamite that let's us blast through rocks. We'll also be wanting some kind of ping sound for when we pick up the gems. Lastly some music would be nice.

Here is a flag, a rare coin (we need to collect them all to proceed), a block (to stop us getting to the exit before we've collected the rare coin), a bomb and a detonator. Again feel free to use these sprites. I've also acquired a sound in wav format (ping.wav) and music in midi format (music.mid). Music and sound effects can be found all over the Internet:

Page 3 of 5 | «Prev12345Next»
3
Liked It
I Like It!
Related Articles
Make Your Own Computer Games  |  Playing with Fire
Comments (1)
#1 by Gurtaton, Sep 30, 2008
This is the longest article I ever read....
Post Your Comment:
Name:  
Copy the code into this box:  
Post comment with your Triond credentials?
Inside Gameolosophy

Accessories

 /

Consoles

 /

Games


Popular Tags
Popular Writers
Powered by
Gameolosophy
About Us
Terms of Use
Privacy Policy
Services
Submit an Article
Advertise with Us
Contact

© 2007 Copyright Stanza Ltd. All Rights Reserved.