Gameolosophy > Games

Make Your Own Maze Game with Game Maker

(contd.)

Page 2 of 5 | «Prev12345Next»

Now five folders down from the 'backgrounds' folder is a folder called 'objects'. Right click on this now and select add object. There isn't much to do yet. Just call him 'obj_character' and note now that we have a 'sp_character' (which is the sprite) and 'obj_character' (which is an object). Objects in game maker are the things you can control the behavior of. By adjusting their behavior you create the rules by which the game is played. For now there is nothing to do except select the sprite you want for 'obj_character' which should be 'sp_character'. Then do the same for each of your sprites (create an object and select its sprite).

You should now have 3 sprites, a background tile, and 3 objects (with their sprites set to the appropriate object). Now it's time to add a room. The folder below the 'Objects' folder is called 'Rooms'. Right click on 'Rooms' and select 'add room' from the drop down menu. The room window will now open.

Change 'snap x' and 'snap y' both to 32. This means that your objects will snap to a grid of 32x32pixels and keeps things tidy (indeed it keeps the game working correctly). Notice that in the left hand bar we are in the objects tab, and that one of the objects you added earlier is selected in the drop down box. You can pick different objects and add them to the room using the left mouse button, and you can delete them using the right mouse button. Play about with this and then delete everything (because we'll be adding the floor tiles first). Click the tiles tab in that side-bar. Now paint in your floor tiles. Holding down shift lets you paint in multiple tiles as you move your mouse around.

Once you've added your floor tiles, go back to the objects tab and start adding in some walls. You can turn the grid on and off by clicking on the button (with a little grid in it) beside 'snap x' and 'snap y'. Now paint in your walls, making a loose maze configuration, add some gems, and your character. None of them will be able to do anything yet, but you can see how the first level is going to look. In the settings tab in the side bar you can set a caption for the room. The caption will appear in the window's titlebar when you run the game. For now we're happy with the room we've created, it's time to program in some actions so our little character can run about the level and collect gems.

Double click on 'obj_character' and the object properties window opens. We want to give our character a keyboard event so that when the player presses the left key our character walks right, and so fourth through the different keys. Click the 'Add Event' button and from the event selector choose 'Keyboard' then < left >. Now we drag and drop actions into the actions box. Under the 'control' tab find the 'If the instance is aligned with a grid' icon:

Once you've located it, drag it into the actions box. It will then pop up with an options box. Choose 'snap hor:' 32 and 'snap vert:' 32 then click OK. This means to the program: If the instance is aligned with a grid 32 by 32 then perform the following action. Now all we have to do is add that action. Click on the 'move' tab and find the red (top left) icon 'Start moving in a direction' and click and drag it into the action's box below the first icon. It will pop up with its properties box. The top radio button should already be set to 'Applies to: Self' so leave that alone then select the left arrow for 'Directions' and set the speed to 4. The relative checkbox should be left unchecked.

Now repeat the process, assigning the keyboard keys to each of the three remaining directions, right, up, and down. All will be set in the exact same way with exception to the arrow you click on in the 'Start moving in a direction' in the properties box.

Once you've done all four you might think that's your character ready to roll, but not yet, we need a 5th key event. At the moment the character will just keep going in whatever direction you press without stopping, therefor we need to click 'Add Event' select Keyboard, and select 'No Key' from near the bottom of the list. Now in the 'Start moving in a direction' properties box, this time select speed: 0. And instead of clicking on an arrow direction click the square in the center. Press OK.

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