How do I create a more 'relaxed' platformer jump?

0 favourites
  • 7 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • Hi!

    I am working on a basic platformer (for fun) and don't have many issues when it comes to player movement. What I was wanting to do was give the player a little 'cushion' for the jumping animation, so that they don't have to worry about pressing jump before they leave the platform.

    See below, the first picture is what is currently happening and the second shows the goal jumping area in green.

    Current -

    Goal -

    any ideas as to how i can accomplish this? i've been stumped.

    thanks in advance, i searched the forums but had trouble finding something similar to this, just double jumps and wall jumps everywhere.

  • You could start a timer when the player leaves the ground, not due to a jump. If the player presses the jump key while the timer is below some threshold, trigger a jump. If it's above the threshold, do nothing. Reset the timer when the player hits the ground again.

  • that's a great idea, thank you for the quick response.

    i will give it a try and see how it goes! loving CS2 so far.

  • No problem, I hope you get it working. Also, one last thing that I realized: to force a jump, you'll probably have to set the Y velocity of the platform behavior directly -- give it a negative value of magnitude equal to your jump strength -- since simulating the jump control while in the air won't work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • same here!

    I've been doing some reading about timers and still trying to determine which one would be best fit for the scenario - seems like a duration timer.

    could you please elaborate a little on the 'set the y velocity of the platform behaviour directly?' i totally understand not being able to call a jump control while in the air already, unless double jump were enabled, and it's not.

    thank you again!

  • The "Set Vector Y" action sets the Y velocity of the platform behavior. If, for example, you have jump strength set to 1000 setting vector Y to -1000 would produce the same effect as jumping with that strength.

    For the timer, you could just use an instance variable and increment it every tick.

  • thanks for the help!

    i managed to get the sprite to simulate the jump with the 'set vector y' action within a reasonable time after the falling, but something is still amiss - once you 'jump' from the fall, there is no limit to how many times this can occur, seemingly creating a double,triple,quad jump etc. depending on how many times pressed haha. it's almost as if the timer isn't resetting itself upon landing.

    probably going to have to put this 'feature' on the backburner, causing a bit too much grief. maybe i'll post the capx soon and see if it can be helped.

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