diff --git a/Assets/Player.prefab b/Assets/Player.prefab index 19fd7c5..63645b0 100644 --- a/Assets/Player.prefab +++ b/Assets/Player.prefab @@ -113,6 +113,7 @@ MonoBehaviour: dashDistance: 5 dashCooldownSeconds: 5 lastAttackTime: 0 + lastDashTime: 0 --- !u!50 &-4152331571693237436 Rigidbody2D: serializedVersion: 5 diff --git a/Assets/Teo.cs b/Assets/Teo.cs index 144a025..9cb9384 100644 --- a/Assets/Teo.cs +++ b/Assets/Teo.cs @@ -15,6 +15,7 @@ public class Teo : MonoBehaviour public float lastDashTime = 0; Rigidbody2D controller; GameState gameState; + Vector2 dashVelocity; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { controller = GetComponent(); @@ -27,7 +28,7 @@ public class Teo : MonoBehaviour controller.linearVelocity = new Vector2 ( Input.GetAxis("Horizontal"), Input.GetAxis("Vertical") - ).normalized * moveSpeed; + ).normalized * moveSpeed + dashVelocity; // Attack on click if not on cooldown if (Input.GetMouseButtonDown(0)) { Attack(); @@ -65,6 +66,5 @@ public class Teo : MonoBehaviour Input.mousePosition.y - Screen.height/2, 0 ).normalized * dashDistance; - Debug.Log(controller.linearVelocity); } }