Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float jumpForce = 500f;
- public bool IsJumping { get; set; }
- private bool isGrounded;
- public Transform groundCheck;
- public float checkRadius;
- public LayerMask whatIsGround;
- IsJumping = Input.GetKeyDown (KeyCode.Space);
- if (isGrounded == true)
- {
- if (IsJumping)
- {
- DoJump ();
- }
- }
- public void DoJump ()
- {
- rb.AddForce (Vector2.up * jumpForce);
- }
- isGrounded = Physics2D.OverlapCircle (groundCheck.position, checkRadius, whatIsGround);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement