Hi lukaius

Maybe the most precise way is to use the quadratic function to get a parable effect

Let's say maximum jump height is 'maxHeight'

Then we can have the formula -x^2 + maxHeight (-x^2 is the same as -(x^2), NOT (-x)^2)

Suppose the way from the floor to maxHeight lasts 30 frames (you can change this)

Your 'x' should start in -Sqrt(maxHeight) + Sqrt(maxHeight) / 30

When x == -Sqrt(maxHeight) you are about to take off

When x == 0 you are at maxHeight

When x == Sqrt(maxHeight) you have landed (*)

(*) It may happen that the land where you are traveling is not flat at all, so you may land before reaching the Y position from where you took off or after that (in which case you just need to stop the jump or continue it until you reach the floor, respectively)

What concerns to X scrolling is another issue that has nothing to do with this

The code

when

(jump key

is pressed

)[ if (player

.Floor()) { n

= 1; floor

= y

; player

.position = Positions

.Jump; } ]// n is the number of frames from take off// this should be into your player methodif (player

.position == Positions

.Jump){ y

= floor

-(-pow

(-Sqrt

(maxHeight

) + n

* Sqrt

(maxHeight

) / 30,

2) + maxHeight

); if (player

.Ceiling()) n

= 30 * 2 - n

; // bounce with the ceiling and starts descending with the same speed if (player

.Floor()) // you have landed { player

.position = Positions

.Stand; // or whatever you want } n

++;}// define Ceiling() and Floor()