You need two booleans,
When the user presses the jump button, if
isJumping is false, then call
jump() which sets
If the player's
y velocity is positive then
If the player is coliding with the ground, then isColidingWithGround equals
Sometimes the player is still in contact with the ground after the initial jump impulse, and I find that with using these two flags, it prevents jump() from being called multiple times when jump is pressed.