Created
August 24, 2014 06:33
-
-
Save jquave/d0d24c35cf7133eb8c73 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| float xVel = rigidbody2D.velocity.x; | |
| xVel += Time.deltaTime*playerState.playerSettings.walkSpeed*input.directionalPad.x*playerState.playerSettings.walkAcceleration; | |
| float sign = xVel/Mathf.Abs(xVel); | |
| if(Mathf.Abs(xVel)>playerState.playerSettings.maxWalkSpeed) xVel = sign*playerState.playerSettings.maxWalkSpeed; | |
| // TODO: Use a non-animation based method here | |
| if(player.playerAnimation.currentAnimation=="CrowSprint") xVel *= 1.4f; // Speed up in sprint animation | |
| rigidbody2D.velocity = new Vector2(xVel, rigidbody2D.velocity.y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment