2D asteroids style map wrapping

Beware Crappy Drawing Incoming xD

Time to explain that one I guess. The Green rectangle is your Cameras view and the red indicated rectangles are your “Fake” Worlds. So you See the Green guy moving to the left and the the Red Guy a “Copy” does exactly what the green Guy does. If he Moves he Moves too If he attacks he Attacks too etc. at some point he reaches the trigger Box teleports to the Oposing side of the Screen. Now thats a Math Calculation you can base it on the Camera Position or the Trigerbox+Halfsize or the Global Axis or Screensize thats up to you how you want to Handle that. Grab a Calculator and run the Numbers =)

So than the Transition happens wher Fake Guy and Real guy are both in Camera View. If you would base it on Boarder touch you would never get a result like that. And than the Cycle goes on Green Guy moves into the Trigger->Teleports and the Story repeats itself. You do the same thing for Bullets and Enemys. You can do the Exact same thing if you want Up and Down transitions too than you would have 3 Guys teleporting around.

Thats basicly it in Theory. I can warn you off a Pitfall you maybe trap into early. The greenbox is not always the same Size! Depending on the Resolution and Aspect Ratio. Also you might Trigger Hit Events twice for something like Bullet Hit Events. So make sure you flag the Copys to ignore them.

1 Like