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

Get help using Construct 2

Post » Mon Aug 31, 2015 4:53 pm

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 -
Image

Goal -
Image

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.
B
4
Posts: 4
Reputation: 260

Post » Mon Aug 31, 2015 5:04 pm

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.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,126

Post » Mon Aug 31, 2015 5:09 pm

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.
B
4
Posts: 4
Reputation: 260

Post » Mon Aug 31, 2015 5:23 pm

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.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,126

Post » Mon Aug 31, 2015 5:54 pm

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!
B
4
Posts: 4
Reputation: 260

Post » Mon Aug 31, 2015 6:00 pm

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.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,126

Post » Tue Sep 01, 2015 3:11 pm

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.
B
4
Posts: 4
Reputation: 260


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests