0
\$\begingroup\$

I have a game in which there is a cat that has three states: On Ground, Going Up and Coming down.enter image description here

This is handled by having 3 states, up,ground and down. Now, there is an additional requirement that the cat picks up a power up and becomes invincible. In this special state, the cat doesn't die if it falls through gaps etc. In this state also, there are same animation states : up, ground and down. However, when the cat is in this special state, it's sprite changes to a starry,shiny sprite.

So now we have two sets of animations : one normal, another power up. How can I manage these two sets?

\$\endgroup\$
1
\$\begingroup\$

You might also like to have a look into Animator's Layers.

They allow you to configure and blend several state machines based on the parameters you define (like the ones Exerion says). Giving the right weight and blending type could be easier than complicating the original animation state machine you already have.

\$\endgroup\$
  • \$\begingroup\$ Thank you I will look into layers. So far i have worked only with simple states. This does sound like a solution \$\endgroup\$ – SanSolo Sep 17 '15 at 13:29
1
\$\begingroup\$

You can add new boolean PoweredUp to mecanim, and set a new duplicate group of states upPowered, groundPowered and downPowered. Make transition between corresponding states, i.e ground -> groundPowered, and use boolean PoweredUp as a condition for transition back and forth. Transitions between powered-up states can use the same triggers as non-powered.

\$\endgroup\$
  • \$\begingroup\$ Problem with this approach is, it has to switch between normal and power up states. any_normal_state ---> any_power_up_state---->any_Normal_state. \$\endgroup\$ – SanSolo Sep 17 '15 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.