Created
September 25, 2012 20:15
-
-
Save markusrt/3784166 to your computer and use it in GitHub Desktop.
Unity animate OTAnimatedSprite based on movement speed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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