Enemy Move

Hello!

I’m have some problems with my enemy sprite animation.

To start, i’m using:

  • Unity 5 (2D)
  • C# scripts

I have a script that automatically moves the enemy gameobject to player position. I have 3 animations: PlayerIdle and PlayerWalking. I created a fourth animation called PlayerDamage. It have a trigger that every time a call it, my enemy game object shows the animation.

However, after I create that animation my enemy game object no longer moves . It shows the Walking, Idle and Damage animation normally but the game object is stopped in its initial position. And, if I delete the animation Player Damage from the animator screen all works fine!.

If more information is needed, please ask!

Thanks in advance!

It could be because you programmed it in a certain way, it would be easier for us if you posted the code or just the attack function

You can make a transition from damage state to exit, then add a transition from entry to idle and walk state with appropriate condition to re-enter either in idle or walk state after damage.
I would too make a transition from AnyState to damage with your trigger condition to enter in damage state instantly.

You can create a BlendTree state that blends between idle and walk state depending on a speed parameter so you could end up with 1 state for locomotion.