Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unity 5.x 2D Game Development Blueprints

You're reading from   Unity 5.x 2D Game Development Blueprints Explore the features of Unity 5 for 2D game development by building three amazing game projects

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781784393106
Length 252 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Francesco Sapio Francesco Sapio
Author Profile Icon Francesco Sapio
Francesco Sapio
Abdelrahman Elsayegh Abdelrahman Elsayegh
Author Profile Icon Abdelrahman Elsayegh
Abdelrahman Elsayegh
Arrow right icon
View More author details
Toc

The game

In this chapter, the goal for our game is to apply the walk animation when the player is moving. Furthermore, we will prepare the jump animation for the next chapter. To achieve that, we need to set up the rest of the transitions.

In the Animator window, let's add a new transition from WalkAnim to Idle and name it StopWalking. Then, we need to add a condition that will trigger the transition. This transition will use the parameter PlayerSpeed so that when its value becomes less than one the transition is triggered.

The game

Now that the transitions between Idle and WalkAnim are ready, let's do the same to the JumpAnim state.

We need to make a transition from the Idle state to the JumpAnim state and vice-versa; we will name them StartJump and EndJump, respectively.

However, we are going to need another parameter to see if the player is currently jumping. We can do this by adding another parameter named Jump as a Boolean in the Animator window and set it to false.

This is what the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime