Advertisement
Guest User

Untitled

a guest
Jan 9th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #pragma strict
  2.  
  3. var mainCam : Camera;
  4.  
  5.  
  6. var topWall : BoxCollider2D;
  7. var bottomWall : BoxCollider2D;
  8. var leftWall : BoxCollider2D;
  9. var rightWall : BoxCollider2D;
  10.  
  11. var Player01 : Transform;
  12. var Player02 : Transform;
  13.  
  14. function Update ()
  15. {
  16. topWall.size = new Vector2 ( mainCam.ScreenToWorldPoint (new Vector3 (Screen.width * 2f, 0f, 0f)).x , 1f);
  17. topWall.center = new Vector2 (0f, mainCam.ScreenToWorldPoint (new Vector3 (0f, Screen.height, 0f)).y + 0.5f);
  18.  
  19. bottomWall.size = new Vector2 ( mainCam.ScreenToWorldPoint (new Vector3 (Screen.width * 2f, 0f, 0f)).x , 1f);
  20. bottomWall.center = new Vector2 (0f, mainCam.ScreenToWorldPoint (new Vector3 (0f, 0f, 0f)).y - 0.5f);
  21.  
  22. leftWall.size = new Vector2 (1f, mainCam.ScreenToWorldPoint (new Vector3 (0f, Screen.height * 2f, 0f)).y);
  23. leftWall.center = new Vector2(mainCam.ScreenToWorldPoint (new Vector3 (0f, 0f, 0f)).x - 0.5f);
  24.  
  25. rightWall.size = new Vector2 (1f, mainCam.ScreenToWorldPoint (new Vector3 (0f, Screen.height * 2f, 0f)).y );
  26. rightWall.center = new Vector2 (mainCam.ScreenToWorldPoint (new Vector3 ( Screen.width, 0f, 0f)).x + 0.5f, 0f);
  27.  
  28. Player01.position.x = mainCam.ScreenToWorldPoint (new Vector3 (75f, 0f, 0f)).x;
  29. Player02.position.x = mainCam.ScreenToWorldPoint (new Vector3 (Screen.width -75f, 0f,0f)).x;
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement