I figured I'd make a proper thread on this topic just to keep everything organised, my animations are working fine now, however, I've got this problem where when I stop at times when running my idle animation flips the player left when I want the player to stay facing the direction it is in.
So what I mean by that it is, if the player is running right and then stops, the idle animation plays but the player flips left, I want the opposite to happen and I want the player to stay flipped to the right. I don't have this problem when running left because of course the idle animation is left by default.
if (GetComponent<Rigidbody2D> ().velocity.x < 0)
{
skeletonAnimation.skeleton.flipX = true;
skeletonAnimation.AnimationName = "Run Cycle";
}
else if (GetComponent<Rigidbody2D> ().velocity.x > 0)
{
skeletonAnimation.skeleton.flipX = false;
skeletonAnimation.AnimationName = "Run Cycle";
}
if ( GetComponent<Rigidbody2D>().velocity.x == 0 )
{
skeletonAnimation.AnimationName = "Idle";
}
}
Would be great to have this issue solved, I suspect I'm missing something really obvious, surely there must be a way to keep the animation flipped according to the direction it's currently facing no matter what animation plays? Hope this all makes sense! Sorry, title was badly written.