on 12 Aug 2012
Another Vox Venio update.
Today I implemented variable jumping. Tap jump a little and you jump a small height. Hold it down and you jump a large height. You can see the difference between the two extremes above (though I suppose people with faster fingers than me might be able to reduce the minimum jump).
Naturally, the numbers that control the jumping physics aren’t hard coded. Exact jump heights may be tweaked as the game progresses.
Before implementing this, you could only jump a set height. And that just feels unnatural.
The first crack I had at implementing this used a technique used in Microsoft’s Platformer Starter Kit (that’s the link to the older XNA 3.1 version, I can’t for the life of me find a link to the 4.0 ever since Microsoft rejiggered their XNA site).
The technique there involved something called a “power curve”, where the longer you held down the jump key, the more upward velocity you got, but with diminishing returns. I didn’t like it, it didn’t “feel” quite right (and we all know platformers live or die by how they control).
So I went to see how the masters did it. This site talks about how the physics and controls worked in the old Sonic the Hedgehog games. Sonic’s variable jumps work quite differently to the “power curve” method. Jumping gives you a set velocity. But releasing the jump button early, while you’re still moving upwards at a fair speed, can “interrupt” the jump. Instead of stopping you dead, which would feel abrupt, it gives you a reduced upward speed. It feels nicer than the “power curve” method, and is a lot simpler too!
Click here for all Vox Venio updates.