Multiple physics objects on wrapping map

Hi There,

I have just been looking at the basic physics example and was wondering if there is anyway of using a backdrop sprite for the main sprite to bounce off, but to also have this layer wrap around (just on the Y axis - if this makes it any more doable)

Thanks very much!!!

Hello Yokel Games,

That depends on how large you’ve made the background sprite. All sprites will wrap with the map, but you’ll start to notice a problem as the sprite exceeds half the size of the map. The way sprite wrapping works is that sprites which move more than half the map’s width or height from the camera are physically repositioned so that they approach from the opposite direction. If your sprite is more than half the size of the map you’ll see it suddenly disappear out from under you so that it can approach from the other direction. 

The simple solution is to use two sprites instead of one. The wrapping sprite will have moved offscreen before wrapping, hiding the undesirable effect. Each sprite would be the full map size on one dimension and half of it on the other, and they would be placed side by side so that they fill the map area. If you wanted to wrap in both the X and Y axis you’d use four sprites instead of two.

Awesome, cheers for the detailed explanation mate!!

Hello Yokel Games,

That depends on how large you’ve made the background sprite. All sprites will wrap with the map, but you’ll start to notice a problem as the sprite exceeds half the size of the map. The way sprite wrapping works is that sprites which move more than half the map’s width or height from the camera are physically repositioned so that they approach from the opposite direction. If your sprite is more than half the size of the map you’ll see it suddenly disappear out from under you so that it can approach from the other direction. 

The simple solution is to use two sprites instead of one. The wrapping sprite will have moved offscreen before wrapping, hiding the undesirable effect. Each sprite would be the full map size on one dimension and half of it on the other, and they would be placed side by side so that they fill the map area. If you wanted to wrap in both the X and Y axis you’d use four sprites instead of two.

Awesome, cheers for the detailed explanation mate!!