How to handle an anticipation jump animation?

Hi everyone,
I have a problem now and would like to know how do you work with it.
I am working on a 2d game. When you do a good jump animation you have to do some anticipation. This means that the character first prepares to jump (crouching) and then he jumps. If you do it as one animation it doesn’t work because the character gets the force impulse to jump while you are playing the animation that starts with the anticipation. So he jumps when he is still crouched.

In my animation I have 4 frames of the character preparing to jump in the beggining, I wanted to wait till this 4 frames are played and then give him the force to jump. How could I achieve this movement in a fluid way?

I hope you can understand my question here.
Thanks!
Richard

First of all hello and welcome.

What you could do is in the animation, add an event key at the spot of the animation where your character should be moving upwards. The event can call a function you create in your script that will then add the force upwards.

So instead of say pressing space bar to activate the jump animation and add the force. Make space bar only start the animation and keep the add force part in its own function. Therefore, when that key is triggered it will call your add force function and make your character jump at the right time in the animation.

Hope that helps.

1 Like