Closed jonoxia closed 12 years ago
That's not the only way to do it. You could leave the jump code the way it is, but create a piece of code that causes a player with negative vertical movement to quickly decelerate unless the spacebar is held down. Currently there is no functional difference, but there will be once we have something like a springboard, or any other device that causes the player to move upward for reasons other than jumping.
Done according to Satyr's suggestion in https://github.com/jonoxia/platform-game/commit/e22aad27902eb5f75492d07c65f8f0c7d685bc7b
Most side-scrollers have a control scheme where holding down the jump button gives you maximum height, while tapping it quickly gives you little hops. Right now there is no way to do little hops in this game. It would be nice.
To implement controls like this, though, means being able to continue accelerating upwards for some time after leaving the ground, as long as the space bar is still being held down, which is contrary to how the jump code currently works. So that will need to change.