From the course: Advanced Unity 2D: Platformer Player Movement
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Changing animation based on item - Unity Tutorial
From the course: Advanced Unity 2D: Platformer Player Movement
Changing animation based on item
- So now that we're able to pick up the item and set the animator's value for the EquippedItem to one, which represents our Power Flower, what we're gonna wanna do is switch the animation of the player to reflect that change. Again, let's make sure that we drag the animator window up to the top. We're gonna add a few new animations. As you can see, our animator's actually becoming a little bit messy. We have a whole bunch of different states and now, in order to show that we have a power flower equipped, we're gonna have to duplicate all these states all over again. Now, one way that we can do this is to create a sub-state. If you right-click in this space, you'll see Create Sub-State Machine. We'll select this and you'll see we'll have a new state. We're gonna call this Power Flower, and let's double-click on it. Now, once you double-click on it, you'll see we have a completely new canvas for us to work in. But this is just a sub-canvas of the Base Layer. One thing that we can do is…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.