Spherical World



  • Hi,

    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:

    1. Visuals: making the world look like it wraps seamlessly
    2. 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?



  • I am not 100% sure on what you are trying to do but if you want to make the word warp around on it self have you tried looking at the Snake Demo which has the player do something similar to what I think you are trying to do.



  • I think OP refers to games like Towerfall Ascension, where the sprite can be part here, part there by any amount of pixels



  • TLDR: I'm creating a 2d game that has something like Space Trooper USA (see: on Kongregate), where the user walks around on a sphere.

    I want users, enemies, bullets, etc. to wrap-around (and the camera to show the world as wrapping around).



  • You mean, like Planetoid Pioneers?

    alt text

    You'd basically want to threat it like a big planet, with gravity. Not sure how this would work for other styles, but basically, everything revolves around a central object.

    This approach might be a bit killer, but is better than doing screen by screen checks, or teleporting objects. In my honest opinion of course. Haxeflixel supports physics already, you could give it a try and let us know!


Log in to reply