Choosing the jumping parameters of the platform behavior

Discussion and feedback on Construct 2

Post » Tue Apr 07, 2015 10:51 am

As we know, the platform behavior can be used to control a character and make it jump, however something always bothered me, we have two parameters for the jump:

JumpStrength and gravity

While I understand the need for them (the Y position being calculated with a similar logic to :
Y=0.5*gravity*relativetime^2 - JumpStrength*relativetime + InitialY )

those are still unclear values for the actual person choosing it, we would rather set the height of the jump and how fast the jump is...

And there are ways to do it!

Just have this in mind, H is the height of the jump, T is the time to go from start of the jump to top of the jump, and calculate the values with:

Code: Select all
Jump strength = 2H/T
Gravity = 2H/(T^2) = JumpStrength/T

You want a 300 pixels high jump that take 0.5 seconds to reach those 300 px?
then you need
Code: Select all
JumpStrength of 2×300/0.5 = 1200
Gravity of 2×300/(0.5^2) = 2400

Of course, since the trajectory is not a smooth curve, but a discrete one (since C2 calculates the values at given times), expect it to be slightly imprecise with the framerate, and so do not have a 300px platform to jump on if the jump height is 300px, still a good ballpark figure that you can affect if you want.

for those who want to calculate everything, not just the jump strength and gravity, here's the math part (you need to know two values to calculate the others):
Code: Select all
JumpStrength = T*Gravity
JumpStrength = sqrt(2*H*Gravity)
JumpStregth = 2*H/T

Gravity = JumpStrength/T
Gravity = (JumpStrength^2)/(2*H)
Gravity = 2*H/(T^2)

T = JumpStrength/Gravity
T = 2*H/JumpStrength
T = sqrt(2*H/Gravity)

H = (JumpStrength^2)/(2*Gravity)
H = JumpStregth*T/2
H = Gravity*(T^2)/2
Game design is all about decomposing the core of your game so it becomes simple instructions.
Posts: 2,106
Reputation: 16,436

Return to Construct 2 General

Who is online

Users browsing this forum: Google [Bot] and 5 guests