unity3d - How to handle sprites when moving out of the camera view? -


I am learning Unity 2D and trying to teach myself based on the clone of old games and mine The first is the category (1962 game).

The problem I can not wrap around my head is setting a script (I think this is the right approach) when my angel closes the camera on one edge, it is on the opposite edge Will appear, for example, you are not familiar with SpaceWare, when Peakman closes the screen and appears in the opposite direction. PacMan will be

How should I contact this because there are other games in the list of my cloning projects. This is the same visual mechanic.

I feel completely within my head what can I do, but at the same time I'm so new to Unity that the syntax is preventing me from proceeding. / P>

should be based on: 1) Collision on my edges and it is taken only in the opposite direction or 2) Get based on camera edges.

I just feel like it may happen on the lines of # 2, because what happens if the screen size is different on another computer.

What I was seeing was this "Mathf.Clamp (transform.position.x, 6.0, -6.0 ) "Was. This solved my problem by going out of the screen at one end and reappearing in the second. This is just for left and right edges.

  if (transform.position.x <-6.0 || Transformation.xx> 6.0) {var xPos: float = Mathf compress (transform.position.x, 6.0, -6.0) ; Transform.position = Vector 2 (Expos, Transformation.Sc.)  

Comments