Download

Speed?

I want to make a game where you have to jump to gain speed (similar to bunnyhopping), how do I make it so each time I land a jump it adds speed and when I stop jumping the speed resets to normal walk speed?

I bet this is easy to do. something like have a bool for when you are in the air / landed. and set it so if you “jump” again within X ticks / time that it gives you a boost in speed by X amount or to X speed. then have it if you land and don’t jump you slow down?

you might also be able to setup a var that adjust your gravity based on speed so you can make it slightly easier the faster you go (jump slightly higher)

There are several things you can use from the CharacterMovement Component. For example, you can get “IsMovingOnGround” or “IsFalling” to check if the Character is
in the air or not.

The easiest way to achieve what you want is to make a “FLOAT” variable to count the time that the Player is on the Ground.
Use the “Event Tick” which executes a lot of times. The Event Ticks has a parameter called “Delta Seconds”. This is the time since
the last Tick of “Event Tick”. Means, if it lags 5 seconds, the DeltaSeconds will be 5. Pretty good for calculating some timing.

So how do we use this? You will check with the CharacterMovement Component if the Player is on the ground. If YES, you will GET the
FLOAT you created, add the Delta Seconds to it and SET it again. (FLOAT variable = FLOAT variable + DeltaSeconds).

Which means you are counting up the time you are on the ground.

Now in your JUMP Event, when you press Jump, you check how high this FLOAT is. Let’s say you are allowing a gap of 1 second (you will
want to test what works well). If the Player was only <=1 Second on the ground, you give him a speed up (you can set the Max Walk Speed
with the Character Movement again. Use google if you don’t know how, this is a very popular question).

And after that, you also SET the FLOAT back to 0. (EDIT: You will also want to SET the FLOAT back to 0 when the seconds are >1!)

This should be all to do :X