Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. if (Input.GetKey (KeyCode.A)) {
  2. GetComponent<Rigidbody2D>().velocity = new Vector2 (-speedForce,GetComponent<Rigidbody2D>().velocity.y);
  3. transform.localScale = new Vector3 (-1,1,1);
  4. } else if (Input.GetKey (KeyCode.D)) {
  5. GetComponent<Rigidbody2D>().velocity = new Vector2 (speedForce,GetComponent<Rigidbody2D>().velocity.y);
  6. transform.localScale = new Vector3 (1,1,1);
  7. } else {
  8. GetComponent<Rigidbody2D>().velocity = new Vector2 (0,GetComponent<Rigidbody2D>().velocity.y);
  9. }
  10.  
  11. isGrounded = Physics2D.OverlapCircle (grounder.transform.position, radiuss, ground);
  12.  
  13. if (Input.GetKey (KeyCode.W) && isGrounded==true){
  14. GetComponent<Rigidbody2D>().AddForce (jumpVector, ForceMode2D.Force);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement