2D Player Animation (part 4)

Adding the Jump Animation to the player

Now that we have our flip mechanic completed along with the move and and jump mechanic finished, it is time to add in the Jump animation to our player. We will also be learning how to create select certain frames to smooth out the jump animation.

Objective: Add an Jump animation to the player

Player Animation Setup:

Once you have sliced and divided the animation frames from the animation sheet, we are going to select only a few frames to incorporate into the animation only.

In the animation sheet, we will noticed that this animation sequence has the player squat downward before initiating the jump and also has frames for the player landing, but since our player jumps and lands so quickly, having that initial squat is unnecessary.

Instead we are going to only add a few frames that simulate the beginnings of the jump and have the last frame hold for a longer duration to create that “gliding effect”.

Next in the Animator window, we need to create a new Bool parameter and set that parameter as a new condition on when to toggle the jump animation.

I also created transitions from the Running state to the Jump state along with Idle to Jump since both these states are able to toggle the jump at any time. For the transitions, I set the conditions to the jumping boolean. “True” for when the player is transitioning to the Jump animation and “False” for when they return back to the original state.

Player & Player Animation Script:

Since we are housing all of the animation toggles within the player animation script, need to create a boolean switch from the player script to the player animation script to toggle the animator parameters.

In the Player Animation script we are going to create a new public method which will control the Jumping animation. Since we have already created the references from the move method, we don’t need to relink the animator component.

In the new public method we are going to create an If statement which determines whenever the set bool is either true or false, and with either parameter is togged the proper animation would be displayed.

We will also be adding a bool for the method so we can pass down the bool data from the player script.

In the player script within the movement method, during the Space keycode input we are going to toggle the jump animation. At the same time we are going to pass down the bool as “true” to let the player animation script know and play the jump animation.

To stop the jumping animation from looping itself and have the player return back to either idle or Running animation, we need to set the jump bool to become “false” when the player is grounded. This is perfect since we already have a bool method called “IsGrounded” that checks whenever the player is grounded.




A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

My pick of best free softwares

Tech Satori Best free softwares

Microservices vs. SOA

PHP Community On Upgrading To PHP 7 Hosting

Improving processes and development flow with automation, War Dragons case study

Solution to SQL Temporary Tables not being supported in Application Studio

How To Build A Web App, part 10 of ?: Testing

The Dexible Core Team Meets in D.C. for Team Intensive #1

Generating API documentation for TypeScript packages with TypeDoc

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simon Truong

Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

More from Medium

2D Mobile Game: Multiple Tilemaps

Creating the Main Menu

Level Design in Unity Part 2: The Walls

My journey becoming a Unity game developer: 2.5D Infinite Runner-URP and Player’s 3D model added