How to make a Platform game

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

Adding behaviors

Construct 2 comes with lots of behaviors. These make your objects work in pre-defined ways, which often saves loads of time. It's possible to re-do everything the behaviors do in the event system, but it is often difficult and time consuming to do that. That's why behaviors are really handy to get your game up and running quickly!

The Platform behavior can take care of the complexities of platform movement for us. However, there's one important tip for using it: the behavior should be applied to an invisible rectangle object, and the player positioned on top. The Platform behavior works much better if the object with the behavior doesn't animate, since changing animation frame can leave the object partly sticking in to a wall which can confuse the Platform behavior. Also, it avoids silly collision situations like your player hanging off a ledge by their nose or something they're holding.

So we need to make an invisible square for the movement first. Double-click the layout to add a new sprite again, and this time import a square like below. (Right-click and 'save as' if you need it.)

A square
As before, we should have the origin at the bottom. So click Set origin and image points again and press 2 (or use the quick assign menu) to position the origin at the bottom.

Hotspot set
Close the image editor. You should now see it in the layout. Resize it to roughly the same size as the player's body as shown below - this size is 53x107.

Player's collision box
Rename this object to PlayerBox since it's the box for movement and collision testing for the player. Also, in the Properties Bar, set Initial visibility to Invisible since we don't want to see it.

We also want to give the Platform movement to the PlayerBox object for more reliable collision detection. Still in the PlayerBox's properties, click Add / Edit by Edit behaviors in the properties bar. In the dialog that appears, click the green plus button.

Adding a behavior
Double-click the Platform behavior.

The Platform behavior.
You should see that some new properties for the platform movement have appeared in the Properties bar. You can tweak the movement settings like speed and acceleration. Let's make the jumps a little bit more snappy. Set the Jump strength to 1100 and the Gravity to 2500.

We also want the screen to follow the player, so click the green plus again and add the Scroll To behavior.

Once you've added both behaviors, close the Player behaviors dialog.

Adding the Solid behavior

The platform movement needs to know what objects it can land on. The player will fall through any objects which don't have the Solid behavior. So this time select the Tile sprite and add a behavior for it, this time choosing the Solid behavior.

We just now need to position the player on top of the PlayerBox. Switch to Event Sheet 1. This is where we define the game's logic using Construct 2's event system.

Switching to the event sheet.

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,815 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.3k 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,575 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,228 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,635 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 201.1k rep

@Plejground, have you seen the manual?

Wednesday, February 29, 2012 at 11:18:05 AM
Plejground 2,635 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 201.1k 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,635 rep

Yes you probably right :)
Thanks for your time

Wednesday, February 29, 2012 at 11:58:17 AM
thiago 4,282 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,282 rep

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

Wednesday, April 04, 2012 at 3:42:25 AM
Weazl 2,932 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,715 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.