How do I keep jumping until I release the button/key

0 favourites
  • 14 posts
From the Asset Store
Piano Keys
$3.99 USD
A musical typing game where the goal is to play a song by pressing the matching keys as fast as you can!
  • Like in fighting games where if the up key of the controller is pushed, the character continue jumping forever until the key is released.

    By default platformer behavior just jumps once, and if you want another jump you need to release and push again.

    Any idea how to achieve this in c2 with the platformer behavior?

    Thanks!

  • Hey there! This should be pretty easy to get done . Try this, While button (up for instance) is down, set platform vector Y to -80 (you may want to change that number, but make sure it's a negative number).

  • Do you mean jumping when he hits the floor or continuously jumping mid-air?

    For the first case it's

    Is on Floor |

    [Button is Down] | Simulate control > Jump

  • Oh snap did I misunderstand this lol? MPPlantOfficial has a good solution

  • you can set the double jump on in the platform settings but then the player needs to contact a platform before they can jump again.

    I have not found a way to continually jump using platform because of that and air jumping does not seem possible but if someone has figured it out I would be interested as well.

  • you can set the double jump on in the platform settings but then the player needs to contact a platform before they can jump again.

    I have not found a way to continually jump using platform because of that and air jumping does not seem possible but of someone has figured it out I would be interested as well.

    Actually the set Y vector idea I mentioned would work for infinite air jumping, you;d just need to set a timer for it to have intervals.

    On button pressed, set Y Vector to negative (your value),

    On button is down, every X seconds, set Y vector to negative (you value)

  • > you can set the double jump on in the platform settings but then the player needs to contact a platform before they can jump again.

    >

    > I have not found a way to continually jump using platform because of that and air jumping does not seem possible but of someone has figured it out I would be interested as well.

    >

    Actually the set Y vector idea I mentioned would work for infinite air jumping, you;d just need to set a timer for it to have intervals.

    On button pressed, set Y Vector to negative (your value),

    On button is down, every X seconds, set Y vector to negative (you value)

    Nope sorry- doesn't work with Platformer behavior. It will play an animation but is not a jump and the platformer has to contact a platform in order to perform another jump.

    BUT if you want to post a capx I will look at your solution.

  • >

    > > you can set the double jump on in the platform settings but then the player needs to contact a platform before they can jump again.

    > >

    > > I have not found a way to continually jump using platform because of that and air jumping does not seem possible but of someone has figured it out I would be interested as well.

    > >

    >

    > Actually the set Y vector idea I mentioned would work for infinite air jumping, you;d just need to set a timer for it to have intervals.

    >

    > On button pressed, set Y Vector to negative (your value),

    > On button is down, every X seconds, set Y vector to negative (you value)

    >

    Nope sorry- doesn't work with Platformer behavior. It will play an animation but is not a jump and the platformer has to contact a platform in order to perform another jump.

    BUT if you want to post a capx I will look at your solution.

    Here: https://www.dropbox.com/s/smtype3mr3ss5 ... .capx?dl=0

    Also OP, you'll probably want to take a look at the capx, assuming you're still having problems. I made an infinite floor jumping example, an infinite non-floor jumping example, a flying example, and a double-jump example that adjusts jump height based on whether you're keeping your jump key pressed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • >

    >

    I looked at the CAPX and it might work for the OP application but not for what I am doing and it does not simulate a real jump which goes forward not just up from a swinging vine. The speed the player is moving effects that jump which is missing in your example. I tried it with my game and player falls down instead of jumping because no forward momentum.

    Once that player is up you are just maintaining the vector but not simulating an actual jump with momentum. I may be able to tweak it by changing gravity and and hang time.

    Thanks though and maybe the OP will be able to use it. I will post my capx if I get it to work with what I am trying to do which is a Tarzan vine swinging style game.

  • >

    > >

    > >

    >

    I looked at the CAPX and it might work for the OP application but not for what I am doing and it does not simulate a real jump which goes forward not just up from a swinging vine. The speed the player is moving effects that jump which is missing in your example. I tried it with my game and player falls down instead of jumping because no forward momentum.

    Once that player is up you are just maintaining the vector but not simulating an actual jump with momentum. I may be able to tweak it by changing gravity and and hang time.

    Thanks though and maybe the OP will be able to use it. I will post my capx if I get it to work with what I am trying to do which is a Tarzan vine swinging style game.

    Not really actually. the player still moves along the X axis when using the Y vector jump in my example (X vector is never adjusted and the standard platform movement is used for left/right). If you'd like to discuss it more PM me since this thread looks like it's getting hijacked.

  • .

    Yes it moves but it moves a set distance because there is no momentum calculated in so basically you are walking steps a set amount instead of actually jumping.

    It is the difference of when you run to the end of a platform and jump or just stand on the end of the platform and jump. Once your player is in the air there is no platform to add momentum so you get a set jump a set distance.

    It might work for the OP if all he needs is to stay in one position but it misses the mark for what I am doing.

    Thanks anyway!

  • https://www.dropbox.com/home?preview=Yv ... entum.capx

    If this doesn't do the trick, PM me. lamar

    EDIT: Here is a version accounting for both X and Y vectors depending on platform speed. It's kind of like running around on the moon lol: https://www.dropbox.com/s/c19jqkqszp8lh ... .capx?dl=0 . Infinite jump is still enabled with key down so you can see it's independent of solid ground; you'll need to fuss with that I'm sure to take into account the vines you're swinging from (assuming this solution is adequate) or your platform will just keep moving in that direction until they're back on the ground (though adjusting the local variable I added, or even adding a separate one for the X vector can be pretty helpful in padding the mount of excess movement you get with the platform speed). My guess is that you already have some variable that determines whether the player is swinging or not so that will likely be enough to stop the excess movement altogether. I can think of other solutions that aren't vector based but I figured exhausting the idea might be helpful to someone at some point, if they're interested in using the platform behavior a bit differently.

  • you can set the double jump on in the platform settings but then the player needs to contact a platform before they can jump again.

    Then do a workaround. On descent spawn a tiny invisible platform for the player to make contact with and do his air jump.

    On Is Jumping | Destroy Platform

    On Is Falling | Spawn Platform Player.Y + 10 Pixels

    Every Tick | Set Platform.X to Player.X

  • > you can set the double jump on in the platform settings but then the player needs to contact a platform before they can jump again.

    >

    >

    Then do a workaround. On descent spawn a tiny invisible platform for the player to make contact with and do his air jump.

    On Is Jumping | Destroy Platform

    On Is Falling | Spawn Platform Player.Y + 10 Pixels

    Every Tick | Set Platform.X to Player.X

    I have tried that but it gives a jerky response. You can see the player contact the platform.

    I may be able to tweak gravity and increase jump strength but I think I am going to have to go with physics in order for it to maintain the momentum of the vine swing.

    It works with double jump off one vine but when you contact the next vine there is no momentum for a second jump because of the way platformers are set up.

    I will get my capx up and let you guys play with it and see what you come up with for a solution.

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