Created
August 24, 2014 06:34
-
-
Save jquave/19430f165c67611ba933 to your computer and use it in GitHub Desktop.
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
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