Problem with inconsistent gravity (KinematicBody2D, with physics_process)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PugMasterPug

I am making a platformer and I have noticed that many times when I jump, the height doesn’t seem to be consistent. Most of the times it jumps about the same height, but every once in a while it jumps considerably higher.

I assume this could be caused by the gravity being inconsistent. The way the game is programmed, when I jump, an upwards velocity is set to the player, and there’s always a gravity being added (which I multiply with delta), and when the player releases the jump button, a stronger gravity is applied.

I had a problem like this in the past, but it was fixed when I moved all the physics to physics_process().

Here is a minimal link to the project:

Any help is appreciated.

:bust_in_silhouette: Reply From: flurick

Try removing the extra delta calculation since it is made by move__and__slide()