Is there a relatively easy way to make my game world wrap around?
It's a 2D game. It's not just the player that wraps around, but enemies, bullets, etc.
Has anyone tried this before? It seems like there are two parts to this problem:
- Visuals: making the world look like it wraps seamlessly
- Objects: making them move appropriately and act reasonably when they straddle boundaries
I thought about doing this by replicating and "linking" elements at the edges, eg. if an enemy is straddling the right-side border, I copy and synchronize it's position/health/etc. with the copy on the "other side" of the world.
Someone at one of the world corners would have up to four copies of itself.
This doesn't exactly seem like the right approach. It seems like it might interfere with collision detection, physics, etc.
Alternatively, is there an easy way to just get the camera to wrap the view around?