Jump button using energy when already midair / Regeneration by percentage? [RESOLVED]

Hi there,

I have made a basic energy and energy regeneration system, with a max energy of 100. Jumping consumes 10 energy, and the HUD displays that correctly, but if I press space while I am already midair, even though it won’t do anything, pressing space again will also consume energy.

How do I make it so that energy is taken only if the jump is actually performed?

I would also like to know how to set the energy regeneration to be a percentage of the maximum energy, rather than as a flat number. Currently it is set up to be regenerating 10 per second, but I would eventually like to add in items or skills that allow the maximum energy to be increased. As it is now, the regeneration would remain the same even if the maximum energy is increased.

Thanks,

eLeMeF

I got the percentage regeneration working. Really simple, no idea how I missed it the first time.

123151-energy_percentage.png

Worked out how to do the jumping one too. Again, really obvious, just somehow missed it.