From 7ab17418bb1f3289a8d011aef546b15f6870f1bf Mon Sep 17 00:00:00 2001 From: allylikesfrogs Date: Wed, 3 May 2023 10:09:55 -0700 Subject: [PATCH] trying dash things --- Assets/Scripts/PlayerBehavior.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/PlayerBehavior.cs b/Assets/Scripts/PlayerBehavior.cs index 3c0bea2..09deaa9 100644 --- a/Assets/Scripts/PlayerBehavior.cs +++ b/Assets/Scripts/PlayerBehavior.cs @@ -24,6 +24,8 @@ public class PlayerBehavior : MonoBehaviour [SerializeField] private float dashStopSpeed = 0.01f; private float currentDashTime; public bool isDash = false; + public Vector2 moveDirection; + public float dashDistance = 5; [Header("Grappling:")] [SerializeField] public Tutorial_GrapplingGun grapplingGun; @@ -104,17 +106,15 @@ public class PlayerBehavior : MonoBehaviour } if (!playerController.IsGrounded() && (currentDashTime < maxDashTime)) { - Vector2 dashSpeed; if(forward == 1) { - dashSpeed = new Vector2(1,-1) * dashMult; + moveDirection = transform.right * dashDistance; } else { - dashSpeed = new Vector2(-1,-1) * dashMult; + moveDirection = -(transform.right) * dashDistance; } - - _rb.AddForce(dashSpeed, ForceMode2D.Force); + //_rb.AddForce(dashSpeed, ForceMode2D.Force); currentDashTime += dashStopSpeed; print("cdt " + currentDashTime); }