Help with animation.

Hello all new here. Well I have a 2D running game & I have it to double jump with the animation playing but once the animation is done it goes back to running before it even hits the ground so I made a landing animation & not really sure how to apply it cause when I make a transition now my player is stuck at an animation. I would only want the character to run when it’s on the ground. Can anyone help?

Hi there!

For jumping, I’d suggest using a Blend Tree for the animation. Given some value (perhaps like the characters velocity in the Y direction) you can pick a certain frame from the jump animation so that it looks like a natural jump and the animation plays for the whole jump motion (this would also work nicely for a double jump). You can also have some kind of ground check that sets a boolean in the Animator window (isGrounded) to true or false. That way, you can play certain animations if the character is on the ground or not. This tutorial could help with the ground check if you don’t already have something for that figured out.

Hopefully those point you in the right direction!