Skip to content

Instantly share code, notes, and snippets.

@markusrt
Created September 25, 2012 20:15
Show Gist options
  • Save markusrt/3784166 to your computer and use it in GitHub Desktop.
Save markusrt/3784166 to your computer and use it in GitHub Desktop.
Unity animate OTAnimatedSprite based on movement speed
if(
// NEW instead of movement.isMoving
movement.speed>movement.walkSpeed/10
&& !"runRight".Equals(sprite._animFrameset))
{
sprite.PlayLoop("runRight");
// NEW adapt playback speed based on movement speed
sprite.speed = movement.speed/movement.walkSpeed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment