Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (gameObject.transform.position.y > top + radius)
- {
- gameObject.transform.position = new Vector2(gameObject.transform.position.x, bottom);
- }
- else if (gameObject.transform.position.y < bottom + radius)
- {
- gameObject.transform.position = new Vector2(gameObject.transform.position.x, top);
- }
- else if (gameObject.transform.position.x > right + radius)
- {
- gameObject.transform.position = new Vector2(left, gameObject.transform.position.y + 1.5f);
- }
- else if (gameObject.transform.position.x < left + radius)
- {
- gameObject.transform.position = new Vector2(right, gameObject.transform.position.y - 1.5f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement