Commit da640815 by Philipp Adolf

Only allow a single dash in the air

parent 26ecec69
......@@ -36,6 +36,8 @@ public class PlayerControl : MonoBehaviour
public float dashCollisionCoolDown = 1.5f;
[HideInInspector]
public float currentDashCoolDown = 0.0f;
[HideInInspector]
public bool hasLandedSinceLastDash = true;
// public float jumpWaitTime = 2.0;
[HideInInspector]
......@@ -109,6 +111,7 @@ public class PlayerControl : MonoBehaviour
lastDashStart = Time.time;
currentDashDirection = dashDirection;
currentDashCoolDown = dashCoolDown;
hasLandedSinceLastDash = false;
}
if (isDashing ())
......@@ -118,6 +121,10 @@ public class PlayerControl : MonoBehaviour
else
{
bool grounded = isGrounded();
if (grounded && !isDashing())
{
hasLandedSinceLastDash = true;
}
velocity = body2D.velocity;
if (Input.GetKey(keyCodes[(int)Keys.Right]))
......@@ -222,7 +229,7 @@ public class PlayerControl : MonoBehaviour
private bool canDash ()
{
return getDashTime() >= dashCompletionTime + currentDashCoolDown;
return hasLandedSinceLastDash && getDashTime() >= dashCompletionTime + currentDashCoolDown;
}
/*==========Power Ups // Bullet management ===*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment