Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1.  
  2. if (gameObject.transform.position.y > top + radius)
  3. {
  4. gameObject.transform.position = new Vector2(gameObject.transform.position.x, bottom);
  5. }
  6. else if (gameObject.transform.position.y < bottom + radius)
  7. {
  8. gameObject.transform.position = new Vector2(gameObject.transform.position.x, top);
  9. }
  10. else if (gameObject.transform.position.x > right + radius)
  11. {
  12. gameObject.transform.position = new Vector2(left, gameObject.transform.position.y + 1.5f);
  13. }
  14. else if (gameObject.transform.position.x < left + radius)
  15. {
  16. gameObject.transform.position = new Vector2(right, gameObject.transform.position.y - 1.5f);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement