2D Toolkit Forum

2D Toolkit => Support => Topic started by: MrDys on June 01, 2013, 08:59:27 am

Title: Sprite screen wrapping?
Post by: MrDys on June 01, 2013, 08:59:27 am
Maybe I'm over thinking this one, but I'm having trouble coming up with a solution to this behavior:

Let's say I have a sprite that can be dragged horizontally. When I drag it off of the right hand side, I want it to wrap around and come out of the left hand side. This goes beyond just resetting the position, tough. If the sprite is halfway off of the screen, I would like the other half to be visible on the other side.

Any ideas?
Title: Re: Sprite screen wrapping?
Post by: unikronsoftware on June 01, 2013, 10:25:58 am
Create 2-3 sprites, place them horizontally.
Treat them as a conveyor belt and as one goes out of the screen on the left, just move it to the far right. Do the same for the right and you've got yourself an infinitely looping sprite.