How to make a Platform game

Favourite 579 favourites
Tutorial written by AshleyOriginally published on 26th, January 2012 - 10 revisions

Creating events

Events work by testing if a series of conditions have been met. If they have, the actions run.

In this case, we always want to position the player on top of PlayerBox. To do this, we should update its position every tick, or frame of the game.

Double-click a space in the Event Sheet View to create a new event.

Adding an event
Double-click the System object, which contains the Every tick condition.

Adding 'Every tick'
Now we have an empty event which will run its actions every tick:

Every tick
Click 'Add action'.

Adding an action
We want to position Player, so double-click 'Player'.

Set position to another object
Double-click Set position to another object. For Object, click <click to choose> and pick PlayerBox. Leave Image point as 0 (that means the origin). Click 'Done'. The finished event should look like this:

The Set Position event.
Hopefully this makes sense: we always position the player on top of the PlayerBox object, which is the object with the movement.

Run the game by clicking the green 'play' arrow in the title bar.

Run the game.
Move and jump with the arrow keys. You've got your first basic platformer up and running!


If you play around you might notice some problems:

1. The player doesn't face left.
2. There aren't any other animations yet.

Let's sort these out! First of all, number 1: let's get the player turning left and right.

First, switch back to the Layout view using the tabs at the top. Double click the layout to insert an object again, and insert the Keyboard object. Since it's just an input object you don't need to place it anywhere - it just enables keyboard input for the whole project.

Instead of creating a whole new animation with the player facing left, we can simply use Construct 2's Set mirrored action, which will automatically mirror the object to make it appear to be facing left instead of right.

Switch back to the Event Sheet. We're going to make a new event with the condition "On left arrow key pressed", and the action "Set player mirrored".

Double click a space to create a new event, or click the Add event link. Double click the Keyboard object, since it contains the On key pressed condition.

Adding a keyboard event
A list of all the Keyboard object's conditions appear. Double-click the On key pressed event.

The 'On key pressed' event.
Construct 2 needs to know which key you want to detect. Click the <click to choose> button, hit the left arrow key, then press OK. Click Done.

On left arrow key pressed.
Now we want to add our action: "Set player mirrored". As before, first you pick the object, then you pick the type of condition or action, then you enter any parameters. Click the Add action link to the right of the event. (Make sure you don't accidentally click Add event!)

Double-click Player.
Double-click Set mirrored.
Leave the state on Mirrored and click Done.

You should now have this:

Set mirrored event
Now add another event - double click a space, or click the Add event link.

This time go through the process again, but make the event On right arrow key pressed, and set the player Not mirrored. You should end up with this:

The mirroring events.
Now when we press left the player's image will mirror, and when we press right it restores the right-facing image. Run the game and try it out!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.


Bigheti 17.3k rep

YES...more one tutorial of the Master Ashley. I learned a lot doing this. Thank you more one time!

Thursday, January 26, 2012 at 8:04:21 AM
sman118 7,806 rep

This is great! Can't wait to see more of this. Will definitely be a huge help.

Thursday, January 26, 2012 at 3:56:29 PM
Velojet 21.2k rep

This is very good, Ashley! It complements my own Platform tutorial nicely. It's great to see the Jungle Platformer graphics in action!

Thursday, January 26, 2012 at 6:13:25 PM
Nickydude 11.3k rep

Excellent tutorial! Looking forward to the rest of it. :)

Thursday, February 02, 2012 at 6:02:42 PM
Sheep 2,571 rep

Can't wait to see the finished tutorial. I can't figure out how to do some stuff you'll probably show. ^_^ Good job and well informative.

Friday, February 03, 2012 at 1:22:27 AM
reindeer11 2,224 rep

I am new to Construct 2 and I think this tutorial is easy to understand and helped me alot ^.^

Thursday, February 16, 2012 at 8:03:55 PM
Plejground 2,623 rep

Yes this is great - Thanks!
But how we can learn more ?
If I want to make anything else or different I don't have an idea how to do that !!
Construct is cool but we need to learn somehow all the behaviors,events,actions etc.. to make our OWN GAME :)
I look forward to see more .. I really need it !!!

Wednesday, February 29, 2012 at 11:17:02 AM
Ashley 200.4k rep

@Plejground, have you seen the manual?

Wednesday, February 29, 2012 at 11:18:05 AM
Plejground 2,623 rep

Yes Ashley I've seen it - it's really good and there is a lot of info - thanks
But what I mean is - each game have different events etc .. and I don't know which one is good for what-
for example if I want to make platform game but with the Knight (so is no shooting - you will kill with the sword) - I don't even know where to look at in the manual :)
Anyway I have too much stuff to learn and this makes me impatient :) and I really want to make my games right now > hahha

Wednesday, February 29, 2012 at 11:37:38 AM
Ashley 200.4k rep

@Plejground try asking on the forum. With these types of things it's impossible to make a guide, because there are usually many ways to do it and it depends on what you are trying to do.

Wednesday, February 29, 2012 at 11:55:24 AM
Plejground 2,623 rep

Yes you probably right :)
Thanks for your time

Wednesday, February 29, 2012 at 11:58:17 AM
thiago 4,274 rep

You could use the Stick behavior instead of setting the the position of the object every thick, am I right??

Tuesday, April 03, 2012 at 3:46:06 PM
thiago 4,274 rep

Sorry, I meant "Pin" behavior, not Stick.

Wednesday, April 04, 2012 at 3:42:25 AM
Weazl 2,928 rep

I'm trying to make a game but when i add the background you can't see the other objects in the layout or in the game please help!

Friday, April 06, 2012 at 6:11:56 PM
osiaslemuel 2,711 rep

@ Weazl right click the background > Z order > send to bottom of layer

Wednesday, April 11, 2012 at 10:24:45 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.