trying dash things

This commit is contained in:
allylikesfrogs 2023-05-03 10:09:55 -07:00
parent fba3f60354
commit 7ab17418bb

View File

@ -24,6 +24,8 @@ public class PlayerBehavior : MonoBehaviour
[SerializeField] private float dashStopSpeed = 0.01f; [SerializeField] private float dashStopSpeed = 0.01f;
private float currentDashTime; private float currentDashTime;
public bool isDash = false; public bool isDash = false;
public Vector2 moveDirection;
public float dashDistance = 5;
[Header("Grappling:")] [Header("Grappling:")]
[SerializeField] public Tutorial_GrapplingGun grapplingGun; [SerializeField] public Tutorial_GrapplingGun grapplingGun;
@ -104,17 +106,15 @@ public class PlayerBehavior : MonoBehaviour
} }
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime)) if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
{ {
Vector2 dashSpeed;
if(forward == 1) if(forward == 1)
{ {
dashSpeed = new Vector2(1,-1) * dashMult; moveDirection = transform.right * dashDistance;
} }
else else
{ {
dashSpeed = new Vector2(-1,-1) * dashMult; moveDirection = -(transform.right) * dashDistance;
} }
//_rb.AddForce(dashSpeed, ForceMode2D.Force);
_rb.AddForce(dashSpeed, ForceMode2D.Force);
currentDashTime += dashStopSpeed; currentDashTime += dashStopSpeed;
print("cdt " + currentDashTime); print("cdt " + currentDashTime);
} }