Closed jonoxia closed 13 years ago
Actually you can get it to happen pretty reliably if you hold the spacebar down as you land from another jump.
If you hold down the spacebar only as you are about to land, you do not jump again immediately; the game waits to learn that this button is being held and not just pressed. At that point, your jump is of variable height. Moreover, in any case, you don't always get double vertical velocity; there are at least four discrete velocities you can get.
This suggests to me that holding down a key calls player.jump repeatedly before player.onGround can return false, perhaps because the heartbeat is substantially longer than how long a held-down space bar waits between presses. Shortening the heartbeat is the wrong answer, but disregarding a held-down space bar is the wrong answer too, since a player might like to be able to bounce while moving by holding down the space bar. Perhaps the right answer is to tell the jump function to set the player's velocity to -30, rather than decrementing it by 30.
Not sure exactly how to trigger it, but I'm guessing that the jump function that imparts vertical velocity is somehow being invoked twice before you leave the ground, giving you double vertical velocity.