GameMaker Platformer Game Development
GameMaker Studio 2 Basics
What is GameMaker?
GameMaker Studio 2 is a complete toolkit for creating 2D games. It's a popular choice for beginners because it makes game development straightforward without hiding the powerful tools you'll need as you get better. You can build games using a simple drag-and-drop system or by writing code.
The coding language used in GameMaker is called GameMaker Language, or GML for short. It's designed to be easier to learn than many other programming languages, which makes it perfect for your first game.
GameMaker Studio 2 is a fantastic option for those just beginning their journey.
Finding Your Way Around
When you first open GameMaker, the interface might seem a little busy, but it's organized into a few key areas. Think of it as your workshop. Everything you need is within reach, you just need to know where to look.
Here's a breakdown of the main panels:
-
Asset Browser: This is usually on the right side of the screen. It’s a list of all the pieces, or assets, that make up your game. This includes your characters' images, the code that makes them move, and the levels they move in.
-
Workspace: This is the large central area. When you want to work on an asset, you'll open it here. You can have multiple assets open at once in different tabs.
-
Room Editor: The Room Editor is a specific tool that opens in the workspace. It’s a visual grid where you design your game levels by placing objects into the scene.
The Building Blocks
Every game in GameMaker is built from three fundamental asset types: Sprites, Objects, and Rooms. Understanding how they work together is the first major step.
Think of it like a play. Sprites are the actors' costumes, Objects are the actors themselves with their scripts, and Rooms are the stages they perform on.
Sprites are the images. A sprite can be a single picture or a series of pictures that form an animation, like a character walking. By itself, a sprite doesn't do anything; it's just artwork.
Objects are the brains. You assign a sprite to an object to give it an appearance. Then, you give the object instructions on how to behave. For example, an object named obj_player might use the spr_hero_walk sprite and have code that says, "When the right arrow key is pressed, move to the right."
Rooms are the game levels. They are large, empty spaces where you place your objects. When you place an instance of obj_player into a room, you see the spr_hero_walk sprite appear on the screen. The game comes to life when you put your objects on the stage.
| Asset | What It Is | Analogy |
|---|---|---|
| Sprite | An image or animation | The costume |
| Object | The logic and behavior | The actor |
| Room | The game level or screen | The stage |
Events, Actions, and GML
So how do you give objects instructions? You use Events and Actions. An Event is a moment in the game when something happens. An Action is what the object does in response to that Event.
For instance, every object has a Create Event. This event runs its code just once, at the very moment the object is created in the room. This is a great place to set up starting values, like a player's health or score.
A Step Event runs continuously, once for every single frame of your game. If your game runs at 60 frames per second, the Step Event code runs 60 times every second. This is perfect for things that need constant checking, like player input.
A Collision Event happens when one object touches another. You could have a Collision Event between your player object and a coin object. The action would be to add to the score and make the coin disappear.
The actions are written in GML. Don't worry, you don't need to be a coding genius. A simple GML instruction to move an object to the right looks like this:
// This code goes in the Step Event
if (keyboard_check(vk_right))
{
x = x + 4;
}
This code checks if the right arrow key is being held down. If it is, it increases the object's horizontal position (x) by 4 pixels, moving it to the right. That's all it takes to get started with movement.
What is the primary role of a Sprite in GameMaker?
If you want a piece of code to run continuously, 60 times every second in a game running at 60 FPS, which event should you use?
That covers the absolute basics of GameMaker. You now know about the interface and the core relationship between sprites, objects, and rooms. The next step is to put this knowledge into practice and start building.