How to make a platformer game

This tutorial makes a platformer game from start to finish with the Platformer game template: a level with a pit to jump, spikes, a key to find, a lift, an enemy and a locked exit, played in your browser. It takes about ten minutes and there is no code anywhere in it.

Open the editor in another tab and follow along:

1. Play the example game

The editor does not start empty: it opens on an example game with two levels, Green Hills and Sky Steps. Every part of a game has its own section here - the player, the levels, the platforms, the items, the enemies, the sounds and the title screen - and you will visit most of them below.

The editor: one card per section, with Play game at the top and the bottom.

Press Play game before changing anything. A minute with the example tells you more about what the pieces do than any description of them. Press any key on the title screen, pick a level with the arrow keys and press Enter.

Green Hills, the first level of the example game.
KeyWhat it does
Left / Right arrow, or A / DRun
Space, Up arrow or WJump - hold it for a higher jump, tap it for a short hop
Down arrow or SDrop down through a ledge
RStart the level again
EscapeBack to the level select
MSound on and off

When you have had enough, press Edit game under the game to come back to the editor.

2. Set up the jump

Open Player. Do this before building anything, because the player's jump decides the size of everything else: a gap wider than a jump can never be crossed, and a ledge higher than one can never be reached.

The box at the top turns the two speeds into the size of a jump.

Two numbers matter most. Movement speed (on the Movement tab) is how fast the player runs, and Jump speed (on the Jumping tab) is how hard they leave the ground. They work together: a jump's height comes from the jump speed alone, but its length is the run speed multiplied by the time in the air, so a faster runner jumps further. The box at the top of the screen does that sum for you - with the defaults, a jump clears about 114 pixels up and 228 across. Keep those two numbers in mind for the rest of the tutorial.

The Jumping tab also holds what makes a platformer feel fair rather than strict. Coyote time lets a jump still work for a moment after running off a ledge, and the jump buffer remembers a jump pressed just before landing. Players never notice either; they only notice when they are missing. Set Number of jumps to 2 for a double jump. Leave everything as it is for now and press Save.

3. Add a level

Back in the editor, open Levels and press Add level. Call it My First Level, leave the gravity at 1800 and press Save. The new level joins the list after the two example levels, and the list counts what is in each one.

The level list. Edit properties changes a level's settings; Level editor changes what is in it.

Press Level editor on the new level's row.

4. Lay the ground

A new level holds nothing but the player start (the blue figure) and the goal (a castle, like the one at the end of the level before it), and the panel on the right says what to do first: build the ground.

An empty level. The toolbar is at the top, the side panel on the right, and the status bar along the bottom.

The toolbar has the three tools - Select, Add and Delete (keys S, A and D) - and next to them what to add: Platform, Item, Enemy, Player start and Goal (keys 1 to 5). The editor opens on Add and Platform, with the platform types of the game in the side panel. Pick Ground.

Now hold the left mouse button down and drag along where the ground should run. Dragging lays a whole run of platforms in one go; a single click lays one. Start under the player, drag to the right and let go just before the goal. Leave a gap a little narrower than a jump - about 120 pixels, half of the 228 the Player screen promised - and drag out a second run on the other side, a little longer than the first.

Is the gap really jumpable? Move the cursor to the edge of the first run. The dashed arcs at the cursor are the player's jump, worked out from the Player screen and this level's gravity: anything inside them can be reached from where the cursor is. If the far side is inside the arc, the player can make it.

The jump reach at the edge of the pit: the far side is well inside it.

A few things make the editor easier to get around. The status bar at the bottom shows the position under the cursor and says what a click will do. Drag with the right mouse button to move around the level and turn the mouse wheel to zoom; the button at the right end of the toolbar fits the whole level in view. Things snap to the grid as they are placed (the magnet button turns that off), G hides the grid and J the jump arcs. A misplaced platform is fixed with the Select tool: click it and drag it, or press Delete to remove it. A paint stroke stops at the edge of the canvas, so zoom out first if a run is longer than the view.

5. Build a climb and hide a key

Flat ground is a corridor, not a level. Over the middle of the second run, pick Block in the side panel and click a block into place a little above the ground. Then pick Ledge and put a ledge above and to the right of the block. Use the jump arcs again: hover over the block and check the ledge is inside them.

A block is solid from every side. A ledge is one-way: the player jumps up through it from underneath, lands on top, and drops back down through it by holding Down. Ledges are what make a climb quick to build, because the player can never bang their head on one.

Now press Item in the toolbar (or 2), pick Key and click just above the ledge. While you are here, pick Coin and put a row of coins along the first run of ground - they are worth 10 points each.

A block, a ledge and the key on top. The arcs show the ledge can be reached from the block.

6. Add spikes

Press Platform again, pick Spikes and click them onto the second run, between the pit and the climb. Spikes are a deadly platform: touching them costs a life. Put them where the player has to jump over them and can see them coming, with room to land on the far side.

Spikes between the pit and the climb.

7. Make a lift

A lift is an ordinary platform that has been told to move. Past the end of the second run, leave a gap far too wide to jump - about 400 pixels - and drag out a third run of ground on the other side of it. Then pick the Lift platform and click one in just past the end of the second run, at the same height as the ground.

Now press Select (or S) and click the lift. The side panel shows its Movement: set Move X to 240 and Move speed to 80. The lift now travels 240 pixels to the right and back again, over and over, carrying whoever stands on it, and a dashed line in the editor shows where it goes. Use Move Y instead for a lift that goes up and down.

The movement is set on the placed platform, so every lift in a level can go its own way.

The player waits at the end of the second run for the lift, steps on, rides it across and hops off onto the third run.

8. Lock the goal

A key does nothing until a goal asks for it. Press Add, then Goal in the toolbar (or 5), and click near the far end of the third run to move the goal there - every level has exactly one goal and one player start, so they are moved rather than added. Then press Size, keys needed and look in the side panel and set Keys needed to 1.

The goal stays shut until the player has picked up as many keys as it needs.

The player now has to make the climb before they can finish. If the goal ever asks for more keys than the level holds, the side panel warns you about it. A padlock now hangs on the goal, counting the keys found so far. Change look, under the keys, makes the goal a flagpole, a finish line, a door, a portal, a cave, a teleporter, a treasure chest, a trophy or a rocket instead, in the colours you choose.

9. Guard the goal with an enemy

Press Add, then Enemy (or 3), and pick Walker. Before clicking, the side panel asks which way it starts walking and its patrol distance - how far either side of where it is placed it walks back and forth. Set it walking left with a patrol distance of 40 and click it onto the third run, between the lift and the goal.

An enemy is placed with the direction and the patrol shown in the side panel.

Jumping on a walker defeats it and bounces the player back up; touching it from the side costs a life. A short patrol keeps it where a single jump clears it. The example game has three other kinds: a Chaser that runs at the player once it sees them, a Bat that flies, and a Spiky that cannot be jumped on at all.

Fit the whole level in view (the button at the right end of the toolbar) to see what you have built.

The finished level, from the player start on the left to the goal on the right.

10. Tune the level

Press Back to return to the level list and press Edit properties on your level. This is where the settings of the level as a whole live.

A level's properties.
  • Gravity is the level's difficulty dial: raising it makes the same jump shorter. The jump arcs in the level editor always use the level's own gravity, so check your gaps again after changing it.
  • Kill plane Y is the line a falling player is lost at. Keep it a screen or so below the lowest platform, so a pit is a pit rather than an endless fall.
  • Time limit gives the player a number of seconds to reach the goal, and every second left over is worth 10 points. 0 means no limit.
  • Camera zoom below 1 shows more of the level at once, which suits big open levels.
  • Background is the scenery behind the level - hills, mountains, a forest, a cave, a city, a desert and more, or a plain colour - in layers that slide past at their own speeds as the player runs. A new level starts with the background of the level before it.
  • Goal is how the goal looks, and how it opens and celebrates when the player reaches it. A new level's goal looks like the one on the level before it, and one tick gives every level's goal the same look.

Leave them as they are and press Save. The types themselves - how wide a ground piece is, what a coin is worth, how fast a walker walks - are in the Platforms, Items and Enemies sections of the editor. Changing a type changes every one of them in every level at once, and Add platform, Add item and Add enemy make new ones: icy ground is a solid platform with a friction below 1, a bonus gem is a Score item with a bigger amount. How the player looks is under Player, on its Look tab, and each enemy type has a look of its own: a knight, a robot, a slime, a bat and more, in the colours you pick. So does each item type: a coin, a gem, a star, a key, a potion, a mushroom and more, spinning, bobbing or swaying, popping as it is picked up.

11. Play your level

Press Back once more and then Play game. Press a key on the title screen, go down to My First Level on the level select and press Enter.

Your level, as the player will meet it.

Play it through: over the pit and the spikes, up the block and the ledge to the key, across on the lift, over the walker and into the goal. If a jump turns out harder than you meant, press Edit game, open the level editor, move the platform and play again - building a level is mostly this loop. Lives and the score carry on from one level to the next, and the game keeps its high score.

12. Sounds and the title screen

Two sections finish a game off. Sounds holds every sound effect - jumping, coins, keys, stomping an enemy, losing a life, finishing a level and more. They are made up as the game is played, so there is nothing to upload: choose the style, the volume and the pitch, and switch off the ones you do not want. Each one has a button to hear it.

The Sounds screen.

Title screen is the first thing a player sees: give the game its name, a subtitle, colours, a background picture or a logo, and watch the preview change as you go. Set the game's own name, and the size of its canvas, under Game properties.

The Title screen section, with its preview.

13. Keep your game

Your game is not saved anywhere
The editor keeps your game in the open browser tab only. Reloading the page or closing the tab loses it, so export it before you leave.

Press Export, next to Play game, and choose how you want your game:

  • Web page (HTML) downloads a ZIP file. Inside it is an index.html with everything the game needs: open it in any web browser and it plays, with no internet connection and nothing to install. Put the files on any website to share your game with other people.
  • Windows program (.exe) downloads one file that opens your game in a window of its own with a double click, on computers with Windows 10 or 11. The first time, Windows may show a blue "Windows protected your PC" window: click on "More info" and then on "Run anyway". Press F11 in the game to play in full screen.

What next?

  • Add a second level and make it harder: higher gravity, a time limit, a Chaser that runs at the player.
  • Give the player a double jump on the Player screen, then build gaps that need it.
  • Open Green Hills and Sky Steps in the level editor to see how the example levels are built.
  • Try another game template.