Here is the formula you must use: V^2 = u^2 + 2aS which becomes: u = sqrt(2aS)
Where S is the distance, u is jump strength, and a is gravity, and v is the final velocity which in your case will always be zero.
Okay so this is how it will work, Make a Global variable called S, a , U
When user presses the Jump key/touch:
- set S to the distance from max jump line to the player(player.y - maxJumpline.y).
- set "a" to the gravity/9.81 of the player(player.behaviour.platform.gravity/9.81) ~ assuming that gravity = x * 9.81, you might fave to test this
- Set U to sqrt(2aS)
- Set jump strength to U
- Simulate player to jump