dash is working better!

This commit is contained in:
allylikesfrogs
2023-05-03 11:53:37 -07:00
parent 6fda5e48b5
commit f7d45185fa
3 changed files with 12072 additions and 265 deletions

View File

@@ -20,12 +20,12 @@ public class PlayerBehavior : MonoBehaviour
[Header("Clarinet:")]
bool unlockedClarinet;
[SerializeField] private float dashMult = 2;
[SerializeField] private float maxDashTime = 5.0f;
[SerializeField] private float maxDashTime = 2.0f;
[SerializeField] private float dashStopSpeed = 0.01f;
private float currentDashTime;
public bool isDash = false;
public Vector2 moveDirection;
public float dashDistance = 5;
public Vector3 moveDirection;
public float dashDistance = 0.1f;
[Header("Grappling:")]
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
@@ -104,17 +104,17 @@ public class PlayerBehavior : MonoBehaviour
currentDashTime = 0.0f;
playerInput.DeactivateInput();
}
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
if (!playerController.IsGrounded() && (currentDashTime < maxDashTime) && isDash)
{
if(forward == 1)
{
moveDirection = transform.right * dashDistance;
moveDirection = new Vector3(1f,-1f,0f) * dashDistance;
}
else
{
moveDirection = -(transform.right) * dashDistance;
moveDirection = new Vector3(-1f,-1f,0f) * dashDistance;
}
//_rb.AddForce(dashSpeed, ForceMode2D.Force);
transform.position = transform.position + moveDirection;
currentDashTime += dashStopSpeed;
print("cdt " + currentDashTime);
}