Platformer Enhancements - Double Jump

Favourite 83 favourites
Tutorial written by BluePhazeOriginally published on 4th, February 2013 - 4 revisions

Introduction

In this tutorial we are going to add some additional functionality to our platformer games in the form of a double jump action for our character. This is a tutorial focused on the actual mechanics and events needed to add a double jump behavior to your character and also some options for tweaking or further controlling the way the double jump works based on the needs of your particular scenario.

Also, please remember if you find this tutorial helpful, use the Vote button to make it easier for others to find it as well. Thank you and have fun!

You can also find my Wall Jumping tutorial here: Platformer Enhancements - Wall Jumping

Tutorial Info

Skill Level: Intermediate
Construct 2 Version used: r114
Can use Free Version: Yes
Plugins used: None
Projects Used: Platform 1 (simple movement)

There are multiple ways that you could implement the double jump behavior. In this tutorial I will cover some of the most common ways it is implemented as well as how you can adjust and tweak it to meet the particular needs of your game. I will also show how to limit double jumping so that you can choose to allow the behavior only when the player has actually jumped vs. when they have fallen off a ledge or platform as I have seen other struggle with detecting whether the character has actually jumped or if they are falling. The events here can be a bit tricky depending on how you approach it and I have seen many folks overthink how to limit the double jump behavior to only work when someone has actually jumped first.

Prerequisites

Before beginning this tutorial you should have a basic understanding of the default platform behaviors in Construct 2. You should also have a basic understanding of how to create sprites, layouts, variables, events and actions in Construct 2 and how to use them. You should definitely complete one or both of the basic platforming tutorials first as this will ensure that you have the required baseline knowledge of Construct 2 prior to starting this tutorial. You can find them here: How to Make a Platform Game and here: Build a Platform Game - A beginners Guide

At the beginning of the tutorial I will break actions down one step at a time for those who are new to Construct 2. As we progress I will start assuming that you know how to navigate the various screens that we have already seen in other steps. I will also mark any actual actions or tasks that you need to do by prefixing them with Action:, this should allow those of you more familiar with the concepts to jump to the actions and skip the explanations.

Setup

We will start with base project by using one of the built in sample .capx files included with the download of Construct 2. In this case I will start with the "Platform 1 (simple movement)" example that comes with Construct 2. I tend to stick to using these basic samples as they are built into construct 2 and do not require that you create your own sprites or resources and can instead focus simply on implementing the behaviors themselves. This tutorial can be completed using the free version of Construct 2 (Using version r114 for my example which can be found here: https://www.scirra.com/construct2/releases/r114 ) once you have Construct 2 installed, from the start page choose the Browse Examples option:


From browse down the list of examples and choose the Platform 1 (simple movement) project.
Open full size image

Once you have the project open, we are now ready to start our work. The first thing we will do is remove any unnecessary objects, in this case the text box.
Here is the basic layout of the project when you first open it:
Open full size image

To remove the text object, simply click on it in your layout, then hit delete on your keyboard. This will remove the text object and also warn you that you have removed the only instance of it from your game. That is fine, we won't be needing it.

Comments

2
Neutronmax 2,499 rep

Awesome, lot's of details and well explained. Tried and worked very well. Thanks!

Thursday, February 07, 2013 at 3:33:11 PM
1
BluePhaze 14.7k rep

Thanks @Neutronmax, Glad it was of use for you! Currently I am in the process of trying to figure out what I want to do a tutorial on next...

Friday, February 08, 2013 at 6:08:28 AM
1
sman118 7,820 rep

Great tutorial. Thanks for including all of the pictures and being so descriptive. If I can make a suggestion for a future tutorial, maybe a lifting and carrying mechanic like in Super Mario Bros 2. I've been trying to do it with having objects stick to an image point, but am always looking for an alternative.

Friday, February 08, 2013 at 5:02:25 PM
1
BluePhaze 14.7k rep

@sman118 I will look into it and see if I can come up with an efficient way to do it. Image points are probably going to be a big part of it though as they are one of the only objects that let us define a spot on a sprite for interaction.

Thanks for the great feedback!

Tuesday, February 12, 2013 at 5:38:05 PM
1
Solano 2,252 rep

hi, thanks for the great tutorial u did there!
helped a lot!
but i cant get this working with a gamepad...
i did all the stuff up there but instead the keyboard action i used my gamepad.
every movement works with the gamepad except the double jump :/
any idea?

Monday, March 04, 2013 at 2:46:03 PM
1
BluePhaze 14.7k rep

if you post a capx I can take a look

Wednesday, March 06, 2013 at 7:27:24 AM
2
orangemicro 3,429 rep

When using a WASD control style, I don't understand why when I change the event of
"keyboard: On up arrow pressed" to "keyboard: On W pressed" it does not seem to want to jump at all.

I feel like logically you should be able to switch out the two without any problems. Do I have to deactivate the defaulted up arrow as jump, if so, I don't know how to do that. Could someone please help me.

Thanks in advanced.

Monday, March 25, 2013 at 8:02:13 PM
1
LiquidProQuo 2,084 rep

Super useful. Thanks!

Tuesday, March 26, 2013 at 10:53:58 PM
1
qu0y 3,151 rep

Hi I am using release 123.2 and I can't find the keyboard object to insert, I know I saw it on previous versions, what happened and how can I make it work around? cheers

Sunday, April 14, 2013 at 3:45:21 PM
3
BluePhaze 14.7k rep

Hey all, just answering some of the questions here:

@orangemicro You just need to make sure you have the keyboard object added and put in the event for Key Pressed W Simulate Platform Jump. If you want to disable the default controls then select your object that has the platform behavior in the layout , and you should see it's properties in the properties pallet to the left. There you can disable the default controls.

@LiquidProQuo Thanks!

@qu0y Double click on the background of your layout the same way you add sprites and you will see the keyboard object. If you don't see it, it is because you have already added it, and it will then be on the right hand side in the objects folder. Also you may want to update to build 125 as it fixes some bugs of previous builds.

Thanks again all for the comments!

Tuesday, April 16, 2013 at 7:56:29 AM
1
BluePhaze 14.7k rep

@Solano Most likely you need to have either a sub event or two events for the jump button being pressed, one if they are on the ground and another if they are already in the air (not on floor expression).

Tuesday, April 16, 2013 at 7:58:29 AM
1
fassFlash 4,377 rep

Yeah, implementing that Space Jump from Metroid

Friday, May 03, 2013 at 7:04:22 AM
1
Vicilius 1,519 rep

I'm just repeating what was already told, but thanks a lot for this great, nice and clear tutorial!

Tuesday, June 04, 2013 at 12:38:00 PM
1
Jijiji 3,656 rep

Very detailed tutorial: great job!

Thursday, September 12, 2013 at 7:25:46 PM
1
almostnot 734 rep

This tutorial was absolutely awesome. Totally clear about how the logic works but also great for new users of Construct 2 as well.

Thanks so much. Double jump is now in my game. Onto wall jump!

Wednesday, December 11, 2013 at 8:05:13 AM

Leave a comment

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