diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 32294801d326f894a31ffe7aab02d463958118f1..a8fd76ce22c5613516c25bf540e8057d1fb9405e 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -2,6 +2,7 @@ public class PlayerMovement : MonoBehaviour { + private bool DoubleSpeed = false; public float speed = 6f; Vector3 movement; Animator anim; @@ -10,6 +11,7 @@ public class PlayerMovement : MonoBehaviour float camRayLength = 100f; public int pet = 0; public GameObject[] Pets; + private void Awake() { if (pet==1){ @@ -44,6 +46,22 @@ public class PlayerMovement : MonoBehaviour Animating(h, v); } + void Update() + { + + if (Input.GetKeyDown("l") && !DoubleSpeed){ + DoubleSpeed = true; + } + else if (Input.GetKeyDown("l") && DoubleSpeed){ + DoubleSpeed = false; + } + if (DoubleSpeed){ + speed = 12f; + } + else{ + speed = 6f; + } + } //Method player dapat berjalan public void Move(float h, float v) {