Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //best thanks to https://www.youtube.com/channel/UCjWeE1oMa9SKWUSdx0LzcRw
- //move all to the place
- topWall.size = new Vector2( mainCam.ScreenToWorldPoint ( new Vector3(Screen.width * 2f,0f,0f )).x,1f );
- //center
- // topWall.center = new Vector2( 0f, mainCam.ScreenToWorldPoint ( new Vector3( 0f, Screen.height, 0f)).y + 0.5f );
- topWall.offset = new Vector2 (0f, mainCam.ScreenToWorldPoint (new Vector3 ( 0f, Screen.height, 0f)).y + 0.5f);
- bottomWall.size = new Vector2 (mainCam.ScreenToWorldPoint (new Vector3 (Screen.width * 2, 0f, 0f)).x, 1f);
- bottomWall.offset = new Vector2 (0f, mainCam.ScreenToWorldPoint (new Vector3( 0f, 0f, 0f)).y - 0.5f);
- leftWall.size = new Vector2(1f, mainCam.ScreenToWorldPoint(new Vector3(0f, Screen.height*2f, 0f)).y);
- leftWall.offset = new Vector2(mainCam.ScreenToWorldPoint(new Vector3(0f, 0f, 0f)).x - 0.5f, 0f);
- rightWall.size = new Vector2(1f, mainCam.ScreenToWorldPoint(new Vector3(0f, Screen.height*2f, 0f)).y);
- rightWall.offset = new Vector2(mainCam.ScreenToWorldPoint(new Vector3(Screen.width, 0f, 0f)).x + 0.5f, 0f);
- //note how it is offset and not center
- //Move the players to a fixed distance from the edges of the screen:
- Player01.position.x = mainCam.ScreenToWorldPoint (new Vector3 (75f, 0f, 0f)).x;
- Player02.position.x = mainCam.ScreenToWorldPoint (new Vector3 (Screen.width -75f, 0f, 0f)).x;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement