Game Maker: From First-Timer to Master
A tutorial by HeroOfHyla
(Note: this will be a multi-part tutorial)
So, you've just downloaded Game Maker, and you're eager to start making games. You open up the project, and you're faced with this screen:
(actually, it will say "Lite" not "Pro" unless you bought the Pro version.)
Now you're thinking WTF? Where's the RTP? How do I even start making games? I'm confused! Well, we're gonna get there. First, we need to learn the Game Maker interface.The Game Maker Interface!
At the top of the screen, you have 2 rows of commands. The top row includes some basic Windows functions as well as some GM-specific ones. The buttons are as follows:
Contains standard functions like "Open" and "Save," as well as the ability to make your game into a playable .exe and to switch to Advanced Mode.
Create, duplicate, and delete resources.
Make new images, sounds, etc. for your game.
Has some helpful scripting shortcuts. We'll look at it further down.
Test your game.
Switch between windows.
An EXTREMELY helpful help file!
On the second row are quick shortcuts to some of the above functions
Now, take a look at the left side of the screen. There are 5 folders and 2 paper icons.
Images for your game.
Sounds for your game. Includes music and sound effects.
Images that are layed in the background of your game. Tilesets also go here, if you use them.
What "runs" the game. Characters, enemies, walls, variable handlers, basically anything that goes on the map.
Basically they're "maps" in RPG Maker
A write-it-yourself help file that is accessed by pressing F1 in-game
Global Game Settings
Resolution, loading image, constants, etc.
Now you should be familiar with the program's basic layout. Let's move on.Your first sprite
There are a few ways to add a new sprite. I like to right-click on the Sprites folder and select "Create Sprite." Go ahead and do that, and a new window will open:
We're not going to deal with making a sprite now, so let's import one that came with GM. Click "Load Sprite." If you're not already in the default GM folder (mine's C:\Program Files\Game Maker7), go ahead and get there. Click on "Sprites." Click on "Various." Double click on "Bear.ico." Now, we're back in the sprite editor, with the bear visible:
Now, let's rename the sprite. Sprite0 isn't very descriptive. I like to use camelNotation for my names of stuff, with a prefix for what type of resource it is. I'm naming the sprite "sprBear". Right away, I know it's a sprite from the "spr" and it's a bear from the "Bear".
Before we do anything else, we should save the project. Click File>Save or just press Ctrl+S. Name it whatever you want.Your first object
Now, we're going to make our first object. Make a new object the same way you made a sprite. I would right click on "Objects" and select "Create Object." This is the screen we see:
See where it says "Sprite: <no sprite>?" Click on the <no sprite> and click on "sprBear" from the list. Now, you have an object with your sprite you created! Easy as pie, right? Well... yes! Of course, it doesn't do anything yet, but we'll deal with that in a second. Before you do anything else, name the object. I called mine "objBear".Your first room
Make a room now. You should know by now to right click on "Rooms" and click "Create Room." And now we see this screen:
Try clicking in the gray area. What's this? A bear suddenly appeared! Yup, it's that easy to add new objects to the room. Just left click to place, right click to delete. A few more things to know: hold down "Ctrl" to move an existing object. Hold down shift to lay multiple copies of an object. Hold down alt to ignore the grid when laying objects. When deleting, hold shift to delete all objects at a particular point, instead of the highest one. Hold ctrl and right-click an object to bring up a menu.
Go ahead and save again.
Now, test your game! Press F5 or click the green arrow to start up test play. Here's what you'll see after it loads:
Close test-play to get back to the editor. Did you notice that the editor closed when you started test play? I'll show you how to disable that later.
WELL... the game works... but it doesn't do anything yet. Let's change that. Open up the object editor for objBear again by double clicking on the object.
Click on "Add Event." Then click <keyboard>. Then click <up>. What this means is that anything you tell the object to do in the right column will activate whenever the up arrow is currently pressed. Now, take a look at the right side of the object editor. See the top left icon, the one that has 8 red arrows on it? Right click on that. A new window will appear:
Click the up arrow and set the speed to 5. Click "OK."
Now, save your game and test it again. Try pressing "up." The bear starts moving up at a rate of 5 pixels per frame (the game is running at 30 frames per second right now). Notice that the bear doesn't stop moving when you let go of up? This is because the speed is never changed when it reaches 5. We'll deal with that in a later installment, but why don't you go ahead and right click on <up> in the left column. Click "Duplicate." Click <keyboard>. Click <down>.
Now, double click on the "Start moving in a direction" action in the right column. Deselect the up arrow, and select the down arrow. Do the same thing for left and right.
Now your character moves in 4 directions! Test it out! It works, but the character can go off the edge of the screen! Wanna fix that? Go into the object editor for objBear. Click "Add Event." Click "Other." Click "Outside Room."
Now, go over to the right side. See the set of icons under "Jump"? Click the second one over in the second row. It's called "Wrap Screen." A new window will open up. Select "Both" from the drop down menu.
Now, when the character leaves the screen, he comes back out the other side. Movement works now! But, the game doesn't have a point AT ALL. Why don't we add money for the player to collect?
Make a new sprite. Select diamond.ico from the same folder you got bear.ico from. Call the sprite sprDiamond.
Make a new object. Select the sprDiamond sprite for it.
Click "Add Event." Click "Create." Go to the right column and add one of those same move commands the bear has. Select ALL of the arrows for the direction, and set the speed to 10. Basically, this will make it select a random direction and start moving at speed 10. Make it wrap around the screen the same way as the bear.
Click "Add Event." Click "Collision." Click "objBear." On the right side, select the "Score" tab. Right-click the top-left icon, "Set Score." Set the score to "1" and check the "Relative" box. This means that 1 will be added to the score each time the player gets a diamond. Go to the "Main1" tab. Right click the recycle bin icon (destroy instance). Click OK.
Now, test the game. This actually feels like a game now! Notice that the score appears in the top bar?
Why don't we make it possible for the game to actually end? Go back to objBear's editor. Click "Add Event." Click "Create." Go to the right side and click "Main2." Right click the top left icon (Set Alarm). Let's make the game last 30 seconds. Set the timer to 900 (30 seconds x 30 steps / second). Press OK.
Click "Add Event." Click "Alarm." Click "Alarm 0." Go to the "Score" tab. Right click on the second down on the left side (show high score). Play with the settings and hit "OK."
Go to "Main2." Right click on the 3rd down on the right side (end game).
Test the game. It works!!!!!!!
Now you know how to make the simplest of simple games. Next week, we'll go further into Game Maker's power. But first, we have some homework:Homework
Make improvements on this game. Try to get the following:
Varying gems of different point-value
Enemies that reduce your score when they hit you
Gems that "respawn" instead of disappearing. (Hint: Take a look at "Jump to random" in the "Move" tab.)
The next part of this tutorial should be up some time next week.