Mario style jumping code

Blitz3D Forums/Blitz3D Beginners Area/Mario style jumping code

Avrigus(Posted 2007) [#1]
Hello everyone,

I'm working on my first 3rd person game and am trying to incorporate a nice smooth jump like the one seen in every Mario Bros game.

I have found a lot of useful jumping code through the forums and have been trying to write my own code that lets you jump higher the longer you hold the jump button down.

Any help or tips would be great :-)


Matty(Posted 2007) [#2]
When jump is 'pressed' set an initial upwards force/acceleration on the character.

For each 'n' milliseconds that the jump button is held down for, up until 'm' milliseconds since the jump started, add a small increase to the upwards force/acceleration - this incremental force which is added should be small relative to the initial upwards force.


chwaga(Posted 2007) [#3]
yeah, or make a variable that acts as the y axis of the character, and while you hold jump, the variable increments, then have a while not holding jump, the variable decrements untill it reaches the ground