Advertisement
Guest User

Flyingv2

a guest
Nov 19th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1.  
  2.         gravity = GetComponent<Rigidbody2D>();
  3.  
  4.         if(Input.GetKey(KeyCode.LeftShift))
  5.         {
  6.             gravity.gravityScale = (0f);
  7.             float x = Input.GetAxis("Mouse X");
  8.             float y = Input.GetAxis("Mouse Y");
  9.             if(x * rigidbody2D.velocity.x < maxSpeed)
  10.             {// ... add a force to the player.
  11.                 rigidbody2D.AddForce(Vector2.right * x * moveForce);
  12.             }
  13.             if(y * rigidbody2D.velocity.y < maxSpeed)
  14.             {rigidbody2D.AddForce(Vector2.up * y * moveForce);}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement