Wrap images around game window

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Wrap images around game window

Post by airstruck »

MasterLee wrote:Thats why i told the sprite position should be defined by upper left conner
Ah, I missed that part. In general I think he has the right idea placing the origin at the center, though.
x=((x-spritezise/2)%size)+spritesize/2
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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 23 guests