Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gravity = GetComponent<Rigidbody2D>();
- if(Input.GetKey(KeyCode.LeftShift))
- {
- gravity.gravityScale = (0f);
- float x = Input.GetAxis("Mouse X");
- float y = Input.GetAxis("Mouse Y");
- if(x * rigidbody2D.velocity.x < maxSpeed)
- {// ... add a force to the player.
- rigidbody2D.AddForce(Vector2.right * x * moveForce);
- }
- if(y * rigidbody2D.velocity.y < maxSpeed)
- {rigidbody2D.AddForce(Vector2.up * y * moveForce);}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement