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.
-
airstruck
- Party member
- Posts: 650
- Joined: Thu Jun 04, 2015 7:11 pm
- Location: Not being time thief.
Post
by airstruck » Thu Apr 13, 2017 6:32 pm
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.
Users browsing this forum: Bing [Bot] and 24 guests