From 64d16f00f0b275fe38bb82ebeaf9d504e4b6e6a8 Mon Sep 17 00:00:00 2001 From: Andrew Van Buren Date: Sat, 19 Nov 2016 21:03:21 -0500 Subject: [PATCH] Fixed footstep glitch --- Assets/Scripts/HeroMobility.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/HeroMobility.cs b/Assets/Scripts/HeroMobility.cs index fe88725..39ec46f 100644 --- a/Assets/Scripts/HeroMobility.cs +++ b/Assets/Scripts/HeroMobility.cs @@ -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 (); @@ -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 { } } } - + -- 2.22.0