Without checking the boundaries of a window, an image/sprite will gradually disappear beyond the edge of the window as the player/enemy moves out of bounds. Is it possible to keep this behavior, but have the part of the image that is beyond the window boundary appear along the opposite boundary? In other words, an image moving to the right out of the window will gradually disappear into the right side of the window and at the same time gradually reappear on the left side.
Ha! Thanks! I'm grinning IRL because that is such an obvious solution. This foray into game making has so far been full of these little nuggets and little Eureka moments. It reminds me why I've gotten into programming to begin with.
So, on the surface this seemed simple. Handling crossing of borders when the image is only crossing a single edge is easy enough, but handing crossing at corners is more involved. I'll have to think on this overnight. Thanks!
MasterLee wrote: ↑Wed Apr 12, 2017 4:53 am
Crossing the borders would need to draw the sprite four times
No it wouldn't; why would it?
Also, just note how far on both axes is the image beyond the edge in one place, and just use those values subtracted from the image's dimensions in the other place.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
MasterLee wrote: ↑Wed Apr 12, 2017 10:07 am
I mean crossing the borders, not the border. But i had to state it clearer crossing both borders.
Okay, i see what you mean, yeah, worst case, one needs 4 sprites.
Lucyy wrote: ↑Wed Apr 12, 2017 11:33 am
Even if you're crossing multiple borders you'd only need to draw your image twice
At first i thought this too, but i was wrong after i drew it in mspaint; a square (the sprite image) can occupy all 4 corners simultaneously when wrapped around one of them, so that means 4 sprites.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
zorg wrote: ↑Wed Apr 12, 2017 11:34 am
At first i thought this too, but i was wrong after i drew it in mspaint; a square (the sprite image) can occupy all 4 corners simultaneously when wrapped around one of them, so that means 4 sprites.
Oh, I see what you mean. I guess it depends on how you wrap the image I suppose.
I assumed that the corners would wrap too, like if your image leaves the top side of the screen it's come out at the bottom and if it goes out on the left it'll appear on the right that would mean that crossing both the top and left side it would appear at the bottom right side. And that would only require you to draw 2 images.