public void Jump() { if (CheckState(1)) { Rb2d.AddForce(new Vector2(0, JumpForce / Time.timeScale)); } }
//Handles all major player movement functionality private void HandleMovement(float horizontal) { Rb2d.velocity = new Vector2(horizontal * speed, Rb2d.velocity.y); HandleInput(); if (Grounded && Jump) { Grounded = false; Rb2d.AddForce(new Vector2(0, jump_force)); } playerAnimator.SetFloat("movSpeed", Mathf.Abs(horizontal)); }
public void DashMovement() { if (!FacingRight) { Rb2d.AddForce(new Vector2(-500, 0)); } else { Rb2d.AddForce(new Vector2(500, 0)); } DashRecharged = false; }