Gameolosophy > Games

Make Your Own Maze Game with Game Maker

(contd.)

Page 4 of 5 | «Prev12345Next»

Add these sprites same as we did with the original three. Then add the music and then add the sound effect. I'll not go into these steps in detail because we should be well versed at adding sprites. Adding sounds is the same as adding sprite except you'll encounter a new window. Call the sound effect 'snd_ping' and call the music 'snd_music1'. For 'snd_ping' set the kind to 'normal sound' and try out the effects if you like. For 'snd_music1' set the kind to 'Background music'.

Now the fun part is adding the sound effect to our game. Open up the obj_character properties and the Collision with the gem event we created earlier. Click on the main tab and drag and drop the 'Play a sound' icon into the actions box. Place it before we change the score and select 'snd_ping' as the sound to play. Set loop to 'false'. Press OK. Now when you collect gems the game will make a satisfying little ping.

Time to add some background music. To do this, it's best to add a controller object to the game. The controller will deal with all the background stuff. Right click on the 'Objects' folder and select 'add object' calling it 'obj_controller'. It doesn't have a sprite associated with it and will be invisible in the game. Next add it somewhere inside the room. It will appear as a little question mark in the level editor. Now open up the properties for 'obj_controller' and in the create event, (in the main1 tab) drag and drop the 'Play a sound' action into the actions box. Set the sound to be snd_music1 and tick the 'loop' checkbox. Now might be a good time to try the game. You might find you have to adjust the volume of each sound in the sound's properties box, for example if the music is drowning out the sound effects.

Now that that is done it's time to make a flag object. Create a new object and call it 'obj_flag'. Give it the flag sprite. Click on 'Add Event' and select 'Collision' (with obj_character) then in the main1 tab drag and drop the action 'If the next room exists' then the 'go to next room' action. Select the transition you would like in the pop up dialog. This means that when the character touches the flag, the game will check to see if there is a next room to go to, and if so it will go to it.

Time to make a new room. Add a room and add all your walls diamonds and a flag to it. Remember to add your character at whatever position you want him to start off in. Don't forget to add the 'obj_controller' to room2. Then go back to your first room and add a flag to that one. Save your game and run the game. You should be able to walk through the first level to the flag then the game will take you to level 2.

Time to add a precious object to the game and then a block that will only disappear once the precious object has been collected. Add the following objects: 'obj_rarecoin' and 'obj_blocker' giving them the appropriate sprites. Set the obj_blocker's parent object as being obj_block. This means that the obj_blocker will function just like the other blocks we have.

Now open up obj_character's properties and in the 'Create' event add another VAR and this time this time calling the variable 'var_rare_collected' and initializing it at zero, just like we did with the gems variable. This will count the number of rare coins we have collected. It will become useful later. Now click on the 'Add Event' button and create a collision with obj_rarecoin event. This will be similar to the gem collision event; we play a sound (ping though you can change it to something more impressive if you want) set the score relative to 200, and increment the 'var_rare_collected' variable by one, before finally destroying the other instance. Now we only need to make a minor modification to the obj_blocker in order to make it disappear when the rare coin has been collected. Open up the obj_blocker properties and click on 'Add Event'. Select step, then (under the control tab) drag the action 'If the number of instances is a value' into the action box. In the properties box that presents itself, select the 'object' as being 'obj_rarecoin', set the 'number' to 0 (zero) and 'operation' as 'Equal to'.

Now go back through the levels you've created and add blockers that will stop the player going directly to the flag. Then add a Rare Coin somewhere in the level (as long as the place is still accessible to the player ie not behind the blockers). Save your game, and then hit the green play button again to see how it's shaping up. Your game has come a long way!

Page 4 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.