How should I add my Jumping animation?

Hello. I’m working on a 2D platformer following the GameDev.tv Unity 2D course. I’m on the TileVania section. I have a single-frame animation for jumping (I’m a rookie) & is wondering: How do I add that animation in the animator & code. I already have an Idle & Running animation. Thanks for the help.

Hi Zunaim,

It’s great to read that you want to challenge yourself. :slight_smile:

I do not know in which lecture you are but Rick implements a climbing animation which he triggers in certain situations. If you haven’t watched this video yet, I would suggest to proceed with the course. Once you implemented the climbing animation, you do the same for your jumping animation.

Did this help?


See also:

1 Like

Yes I have seen that video but he the climbing animation is triggered on entering upon the trigger. I want to add an animation when the user presses the spacebar. I’ve tried to implement it in the OnJump() function but for some reason, the animation triggers but doesn’t go back to Idle or Running. I’ve checked the animator.

Did you define trigger/bool parameters? Whether you set them to true in an if-block that checks for user input or collisions with layers does not matter. The concept is the same. Make sure “Has Exit Time” is enabled in your animation state. And there must be an exit transition to your preferred state.

1 Like

Can you please elaborate? I’m having difficulty understanding what you mean.

See here:

If you find this difficult to understand or do not know where to start, rewatch the video in the course where we create the “climbing” animation. Instead of another “climbing” animation, you create your “jumping” animation state including the conditions. Just do the same. Once the animation state and the “jumping” animation are working, you could test it with the ladder. Instead of triggering the “climbing” animation, you trigger the “jumping” animation.

If that works, you know that the animator part is correct. Then you could undo the changes in the code and create a new method for the jumping.

Also please feel free to ask our helpful community of students for advice over on our Discord chat server.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms