Gameolosophy > Games

Make Your Own Maze Game with Game Maker

(contd.)

Page 5 of 5 | «Prev12345 Next

You might also notice before they get collected that the character is beneath certain objects, such as the coins and gems. The level at which every object sits can be controlled in its properties window. Since obj_character is sitting at 0 (zero) depth, give other objects such as coins, blocks, and gems an increased depth of 100. Conversely if there is ever anything you want to give the appearance of being above the character you can set a negative depth such as -100 to raise it above other objects. There appears to be no limit to the numbers you can use for depths (it goes ten digits both ways). You can use a variety of depths to achieve some powerful effects.

Now that the blocker is working, lets add a bomb. Earlier I forgot that I would need an explosion. Since I don't have one to hand I photoshopped this rudimentary explosion and saved the sequence as 8 or so individual gif files. I then used a fantastic little freeware application called 'UnFREEz 2.1' by WhitSoft Development ( http://www.whitsoftdev.com/ ) to turn the separate gif files into one single animated gif. Again feel free to save this and use it:

Time to add a new sprite. Load the animated explosion into Game Maker as 'sp_boom'. Set it as transparent, turn off precise collision checking, tick the 'Smooth Edges' check box, and preload texture. Assuming you're using the 96x96pixel explosion gif I've provided you with set the origin as being x:33 and y:33 (the middle of the explosion will sit over the grenade tile). Notice where it says 'show' in the left of that box, you can scroll through the different images in the sequence. Okay that.

Now make an object, 'obj_boom' and in its 'Create' event. In the actions under the 'main1' tab, drag the 'Change the sprite' action into the actions box. In the dialog that presents itself set the 'sprite' to 'sp_boom' and set the 'subimage' to '0' (zero) then set the 'speed' to '1'. This means that the explosion will start at frame 0 and cycle through the animation.

Now 'Add Event' select 'other' and from the drop down list select 'Animation End'. In the actions for this event drag the 'Destroy the instance' event and set it to 'self'. One final event. 'Add Event' and select 'Collision' with 'obj_block' and in the actions box put 'Destroy the instance' and set it to other. So when the explosion comes into contact with blocks it should destroy them.

Now create the 'obj_bomb'. Give it the appropriate icon and add a new event 'Alarm 0'. In the 'Alarm 0' event drag the 'Create an instance of an object' action into the actions box. Set the object as 'obj_boom' (the explosion) and the x and y to '0' (zero) then make sure relative is ticked. Next use the destroy the object (self) to destroy the bomb (having now released the explosion). Okay so now we have a bomb that goes off when its 'Alarm0' is triggered. Time to create the detonator.

Create 'obj_trigger' and give it the appropriate sprite. Next create a collision event with 'obj_character' and then under the actions 'Set alarm 0 to 2' and in the box above where it says 'applies to' select 'object:' and from the drop down list choose 'obj_bomb'. This means when the player touches the trigger a collision event is called which sets 'alarm0' to 2 in 'obj_bomb' in two steps time the bomb will go!

Now create a third room within which to try out your new toys. Notice in the screenshot here the Rare Coin is needed to open up the route to the finish flag, but this is behind some blocks. The bomb is situated nearby so that the player can blow up the blocks and reach the coin, opening up the route to the exit.

Congratulations, you've got a pretty good number of elements. Now it's time to expand on that. With the puzzle elements all ready, now would be a good time to put in some monsters. Get your monster sprite ready. Add it as a sprite. Here's one so you don't have to go hunting:

Then create an object for the monster. In the monster's 'Create' event set it to move left or right using the 'Start moving in a direction' action. When the dialog pops up, choose both the left and right arrows, which means your monster will walk either left or right. Next 'Add Event' and select collision with obj_block, then in actions choose the 'Snap to a grid' and select 32x32. Next add the 'Start moving in a direction' action once again and set it for left and right.

Finally open up your character's Object Properties and click 'Add Event' choose 'Collision' then select 'obj_monster' and in actions, do the following (you should by now have some idea how to do this):

Set the score relative -200

Set the lives relative -1

Restart the current room

This means that 200 will be deducted from the score and 1 will be deducted from your lives. Then the room will be restarted.

Now open up the Object properties for 'obj_controller' click on 'Add Event' then select 'Other' then select 'No more lives' and then add the following events.

Show the high score table

Restart the game

Earlier on we set the score and the lives in the 'create' event of the character. Cut both of those actions and put them in the create event of the 'obj_controller' instead, then set the 'obj_controller' as being persistent. This means that when the room is reset after being killed the obj_controller wont be effected

So now you know how to create monsters, you might want to create monsters that go up and down, as well as left and right. You might also want to create monsters that move about in interesting sequences. Anything is possible.

I guess we are done with this tutorial. Whatever improvements you want to make to your game are up to you. You might want to animate your character so that he actually walks. You might then want to add more puzzles such as blocks that can be pushed around, holes in the ground, extra monsters. The possibilities are limitless. The only thing holding you back is your imagination. I hope you've enjoyed this tutorial and good luck with your Game Making!

Page 5 of 5 | «Prev12345 Next
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.