I’m making a 2d game and have a movement script attached to my slime enemy. This is the section that tells it to move:
IEnumerator Idle ()
{
direction = -1;
while (true)
{
print ("slime has moved");
// Move in a direction
body.velocity = ( new Vector2( idleSpeed * direction, 0) );
// Wait
yield return new WaitForSeconds (2);
}
}
I want to be able to play an animation once every time the slime moves, how can I do this? I’ve tried setting parameters to true, but it doesn’t seem to work…