Help with Double Jump

0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I have an autorunner game and i've searched the forums here for double jump.

    I've found how to do it and managed to insert it into my game, but i have one small issue with it that i was hoping someone can help with.

    The double jump works fine when the player is on the platform, but when my player runs or falls of the platform (no jumping), my player only does the one jump instead of a double.

    I've tried various ways of trying to fix this such replicating the double jump but instead of X platform is on floor, i've replaced it with platform is falling but no luck.

    Can someone help?

  • Perhaps you could make a jump variable. Have 0 be no jumps and have 2 mean you can't jump anymore. When you hit the ground it resets to 0.

    That way you could fall off and still get 2 jumps.

  • Instead of using the simulate jump action, make the first jump be used the same way that the second jump is used (setting Y velocity).

    The simulate jump action can only be done if the player is on the floor, but if you want the player to be able to jump in the air that would be a way to do it. Haven't looked at the code but I hope that helps.

  • Sushin I tried that, and it did kind of work but there are some things i don't like with this. When my player does a double jump, he doers this this motion where he moves back and forth in the air, which doesn't look great. Also, my players starts going through platforms with this.

    Any other suggestions on how to do this?

  • Set a variable to count the jumps. Every time player jumps add 1 to the variable.

    Now create a condition:

    On up arrow pressed and

    if jumpVariable<2 set y vector to -500 //this will make your character jump

    add 1to jumpVariable

    Also add a condition for setting jumpVariable to zero when your character touches the ground

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • May be take a look at the Platform + behavior in the addons section? Its the normal platform behavior but with wall jump and double jump implemented, it works well

  • How about trying this? It doesn't launch him forward like the other way that I tried.

    If this isn't exactly what you wanted it's at least a step in the right direction.

  • izicial makotto Thanks but unfortunately this jump launches my player forward.

    sachos345 I tried the Platform + addon but i still get the same issue...

  • Mmm still, in most game that have double jump when you fall you only can give one jump.

    The problem you have with replacing X is on floor with X is falling is that the first jumps "desactivates" the "X is falling" because now you are jumping.

  • izicial makotto Thanks but unfortunately this jump launches my player forward.

    sachos345 I tried the Platform + addon but i still get the same issue...

    He doesn't launch forward when I do it. I think I had to delete something from your original code.

  • Ok, this is causing a lot more headache than it should so i guess i'll leave it then

    The issue i had with this is that because the game is so fast (my one is, not necessarily this capx), you can easily run/fall off a platform without realising it and can only do one jump when you're trying to do a double jump, which can be frustrating. So what i now want to do is create an animation that plays when the player falls/runs of the platform, this way it can be seen as an indication that you can only do one jump when this animation plays.

    I've created an animation for my character but the problem is that i can't seem to distinguish when the player as fallen off the platform from when the player is falling from a jump.

    I've created the following event but it hasn't worked for me:

    Player - Platform is falling - Set player animation to "falling"

    The animation plays but it also plays when the player is falling from a jump (which i understand, but as i mention, i can't distinguish when the player as fallen off the platform from when the player is falling from a jump)

    Is there i can make this animation play only when the player falls/runs off the platform and not when the player is fallling from a jump?

    I've posted an edited capx where i've added a falling animation (player is just turned upside down) to the existing capx.

  • should be as simple as setting a variable on jump and resetting it on landed..

    So player is falling and variable is not set would be falling of platform


    player is falling and variable is set would mean falling after jumping..

  • LittleStain I'm trying it but i can't get it to work. My double jump disappears when i try this and the animation doesn't set.

    I reckon it's because i'm doing it wrong

    Could you perhaps show me how it's done with the capx i provided please?

  • just adjusted the jump values..

    jump1 is now 1 doublejump is now 2

    only play falling if jump = 0

  • Thanks, that kind of works but now i can do unlimited jumping if i constantly click, which i don't want. Also, i'm not able to do a jump while the falling animation is playing unless its a double click...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)