Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. float moveHorizontal = Input.GetAxis("Horizontal");
  2.         float moveVertical = Input.GetAxis("Vertical");
  3.  
  4.         Vector2 movement = new Vector2 (moveHorizontal, moveVertical);
  5.         rb.velocity = movement * speed;
  6.         rb.position = new Vector2
  7.             (
  8.                 Mathf.Clamp (rb.position.x,boundary.xMin,boundary.xMax),
  9.                 Mathf.Clamp (rb.position.y,boundary.yMin,boundary.yMax)
  10.  
  11.             );
  12.         if (Input.anyKey)
  13.             rocketFire.SetActive(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement