Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update()
- {
- grounded = Physics2D.IsTouchingLayers(myCollider, whatIsGround);
- myRigidbody.velocity = new Vector2(moveSpeed, myRigidbody.velocity.y);
- if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
- {
- if (grounded)
- {
- myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, jumpForce);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement