How to make a platformer game



Attached Files

The following files have been attached to this tutorial:



Download now 362.85 KB



41,887 visits, 205,142 views



This tutorial covered a lot. You may want to revise it some time. Here are some of the key points:

- For the player's Platform behavior, always add the movement to an invisible box with no animations. Position the visible, animated player sprite on top of the box. This will prevent animations causing glitches in the platform movement.

- Levels can be built out of tiles with the Tilemap object.

- The Set mirrored action saves you having to make mirrored copies of all your animations.

- Animations sometimes need some work to get imported, set up with the right speed and looping properties, with the right origin set, and all frames cropped. You may also want to alter the collision masks, although this was not covered.

- Enemies can also be controlled with the Platform behavior. Set Default Controls to No and use the Simulate control action to automatically control movement.

- You can detect if the player is falling on an enemy rather than running in to them by testing if they are both falling and above the enemy on the Y axis when colliding. Otherwise (using 'Else'), they must be running in to the enemy, and they should get hurt.

- Instance variables can store numbers or text unique to each instance of an object. This helps control objects individually, which is useful for "AI".

- Edge markers are a quick and easy way to make enemies go back and forth on a platform.

- Collision polygons can help setting up proper collisions and prevent unexpected bugs/behaviors from happening in your game.

- The Sine behavior can be used to have "floating" like objects in your game.

- You can set a layer's Parallax value to 0,0 in order to have elements that will be displayed on screen all the time, wherever in the layout the camera/scroll is positionned.

Obviously we have not made a full platform game! However, this tutorial has covered the most difficult bits, and the important essentials every platform game creator should know in advance.

You may want to use the Jump-thru behavior on some platforms in your game (allowing to jump on a platform directly from underneath it). In our current game, I would advise you to add a new Sprite object and use it as these specific platforms. Adding the Jump-thru to the Tilemap for example will not work, the Solid behavior will take over.

You may also want to look to the layer's property Parallax. On a project with multiple layers, you can then provide an impression of different layers moving at different speeds, only by setting correctly a few numeric values and have a great visual effect in return.

From here on hopefully you have an idea of how the rest of a platform game is going to come together. It takes time to get familiar with a complex development tool with Construct 3. However, experimenting can be fun, and teach you a lot! So spend a while playing around, breaking things, tweaking things, and see what you can come up with. Happy platforming!

Further reading

You may be interested in the alternative beginner's guide, which is a tutorial to make a top-down shooter. It covers some different points like making a heads-up display, and goes in to instance variables in some more detail too. These are both things that can be applied to platform games, so it would definitely be useful to go through it in addition to this tutorial.

Want to add music and sound effects? See Sounds & Music in the manual.

If you'd like to know more about how events work in Construct 3, see the section on How Events Work in the manual. It's highly recommended so you can get going quickly with your own projects! Then for even more information, don't forget there is complete documentation in the manual.

Thank you for reading, I hope this tutorial contributed to helping you better understand Construct and start make the games you have in mind.

Disabled Comments have been disabled by the owner.