Re: Wrap images around game window
Posted: Thu Apr 13, 2017 6:32 pm
Ah, I missed that part. In general I think he has the right idea placing the origin at the center, though.MasterLee wrote:Thats why i told the sprite position should be defined by upper left conner
Yes, that does work nicely. Not sure if it's an improvement overall; getEdge is simpler like this, but at the expense of more convoluted (and brittle) position wrapping. I'd probably prefer leaving getEdge as it was and using x%size for position wrapping, but I suppose the "better" solution is a matter of personal preference.x=((x-spritezise/2)%size)+spritesize/2