I have a game world that’s much bigger than the view port, the main character stays in the center of the view port at all times and the background layer is moved around to give the impression of the character moving. I want to make it so that the game world wraps, meaning if the the character keeps traveling either left or right they will eventually end up back at the starting position. There will be moving entities in the game world so the biggest problem I foresee is that if you go to the far right of the map you should be able to see any of the moving entities that are within the first small section of the far left of the map.
I’ve thought a bit about this and any solution I’ve come up with seems far too complicated. Like creating two identical game worlds side by side and moving them around accordingly. I live in hope that there is an elegant solution to this. Any expertise you can share would be greatly appreciated.
If you can avoid it, I definitely would. I did in my first game and wish I hadn’t it, it was a massive pain. I used repeating backgrounds so I don’t have any advice on that aspect.
From memory, I think I checked if the player was near to an edge of the world – if they were, I’d move the sprite of anything that was close to opposite edge of the world by the appropriate amount so that it would appear correctly (I was using box2d so wouldn’t move the critter really, just the sprite location).
If anything crossed the edge I’d teleport it over to the appropriate map edge. That way you could fire and be shot at as normal. Until you use beam weapons or similar then it’s horrible.