Platformers are some of the most timeless games we play, period. Games like Mario, Hollow Knight, Crash Bandicoot, Ori, and the Blind Forest defined the genre. All of these conjure up images of beloved gameplay that challenge the player’s hand-eye coordination, timing, and plunge the player into rich and detailed worlds.
Naturally, many want to make platformer games. Luckily, you can choose a ton of roads to start your journey on how to make a platformer.
If you’re one of the many, it’s a great idea to check out some game engines, specifically GameMaker Studio 2. GameMaker Studio 2 is a fantastic option for first-time game developers.
Let’s take it step-by-step on how to make a platformer using the robust and reliable GameMaker.
First thing’s first: you need to have ideas as to what you’re doing. I don’t recommend just booting up an engine and experimenting without any guidance. Make sure to familiarize yourself with the GameMaker reference page for any relevant code and tips that can help you through.
Let’s start by creating a character sprite. Click “Add sprite” two times from the resource tree. This will create our base character sprite as well as help us create a level later on.
Creating A Level
Creating iconic and memorable levels is a massive part of creating a timeless platformer video game. Immersive, colorful, and lively worlds are what sticks in our minds the most.
To create a world, click on the ‘instances’ layer, select your game sprite that represents your character, and place it wherever you wish. Create a sprite called ‘Wall’ and drag the sprite around to create whatever level shape you like to create the basic framework of your platformer world.
Give Player Control
Next, let’s give the engine some instructions so the player can actually control the character sprite. This will have a lot of precise code to type into the fields, so pay attention carefully!
This is where ‘events’ come into play.
Click “Add Event,” followed by “Create.”
You’ll need to start adding code to your GameMaker 2 client now.
Enter the following in the Create field:
grv = 0.2; //gravity
hsp = 0; //current horizontal speed
vsp = 0; //current vertical speed
hsp_walk = 4; //walk speed
vsp_jump = -5; //jump speed
This builds some of the necessary movement capabilities as well as gravity.
To further add to the nuance of game characters moving and their reactions to the game world, let’s add some more code, shall we?
//Get inputs (1 = pressed, 0 = not pressed)
key_right = keyboard_check(vk_right);
key_left = keyboard_check(vk_left);
key_jump = keyboard_check(vk_space);
//Work out where to move horizontally
hsp = (key_right – key_left) * hsp_walk;
//Work out where to move vertically
vsp = vsp + grv;
//Work out if we should jump
if (place_meeting(x,y+1,oWall)) and (key_jump)
vsp = vsp_jump;
//Check for horizontal collisions and then move if we can
var onepixel = sign(hsp) //moving left or right? right = 1, left = -1.
//move as close as we can
x = x + onepixel;
hsp = 0;
x = x + hsp;
//Check for vertical collisions and then move if we can
var onepixel = sign(vsp) //up = -1, down = 1.
//move as close as we can
y = y + onepixel;
vsp = 0;
y = y + vsp;
These actions, as you could probably surmise, allow the player to gain more control of the sprites.
Is jumping the most essential part of a platformer? For my money, it is.
Since jumping is a primary mode of transportation for the player character, you need to make sure jumping is satisfying, smooth, and doesn’t interrupt gameplay in different ways. The above code will allow your character to jump and more.
Creating More Levels
Remember how you created the first level at the beginning? You hold the alt key while dragging after you have the ‘instances’ layer selected, followed by the Wall layer.
Run the Game
Now let’s see if it actually works!
All you have to do is press F5 and wait for the game to compile everything.
Make sure everything is responding correctly, like key inputs and spacebar commands.
If the game doesn’t run properly, make sure that the code you entered isn’t flawed in any way, and make sure to troubleshoot any issues you have.
Don’t feel defeat, however, as this is the crucial time to experiment with your platformer and work out the kinks.
You can go further and inquire as to what could possibly be wrong by going to the forums and checking online for help. There are guides filled with applicable coding and prompts that will have you on your feet and have your characters jumping in no time.
You now have some of the tools needed to succeed in how to make a platformer. You can use the resources of GameMaker and really set your title apart, giving it unique looks and features.
Just remember the necessary steps above, and you’ll be garnering a big audience for your game. Who knows? Maybe you’ll be the creator of the next Limbo or Super Meat Boy?