Commit 64d16f00 authored by Andrew Van Buren's avatar Andrew Van Buren

Fixed footstep glitch

parent ffeb0fff
......@@ -19,8 +19,8 @@ public class HeroMobility : MonoBehaviour {
public AudioClip[] grassFootsteps;
public AudioClip[] waterFootsteps;
public bool canMove = true;
public bool canMove = true;
void Start () {
playerRB = GetComponent<Rigidbody2D> ();
......@@ -35,14 +35,14 @@ public class HeroMobility : MonoBehaviour {
playerMove (input);
if(deltaPos.magnitude > 0.001f && Time.time > lastFootstep) {
lastFootstep += footStepDelay;
lastFootstep = Time.time + footStepDelay;
Footstep();
}
}
void playerMove (Vector2 input){
//Controls hero movement in all 8 directions
if(canMove)
if(canMove)
playerRB.MovePosition((Vector2)transform.position + input.normalized*playerSpeed);
deltaPos = playerRB.position - lastPos;
lastPos = playerRB.position;
......@@ -60,4 +60,4 @@ public class HeroMobility : MonoBehaviour {
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment