Strange fuzziness when animating sprite

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.
Post Reply
electriczaz
Prole
Posts: 2
Joined: Sun Dec 21, 2014 7:14 pm

Strange fuzziness when animating sprite

Post by electriczaz »

Hi there, this is my first jump into Love/Lua and I've been messing around a bit. What I'm trying to do now is animate a sprite as it walks across the screen. Well, it works-- sort of. When the sprite walks, every few frames there's an odd fuzziness around the sprite. I've attached the .love for the project, but here's a picture of what I'm talking about. Any thoughts/suggestions would be greatly appreciated.

Image

P.S. Forgive me if my code isn't perfect. I've just been hacking things together as I go along.

EDIT: I should mention, you use the left/right keys to move and the down key to reset the walking frames
Also, there is a full-size picture of the glitch inside the .love
Attachments
billy.love
(297.38 KiB) Downloaded 141 times
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Strange fuzziness when animating sprite

Post by Jasoco »

I suggest you math.floor the position of every sprite/image you draw on screen.

Alternatively, some people suggest adding a transparent pixel buffer around every single sprite.

Either method works. The first one's easier. But some might say it hurts performance slightly if you have a lot of sprites. I haven't noticed this though. (And I draw over 1500 images per frame all floored)
electriczaz
Prole
Posts: 2
Joined: Sun Dec 21, 2014 7:14 pm

Re: Strange fuzziness when animating sprite

Post by electriczaz »

Perfect! That fixed everything. Thank you very much.
szensk
Party member
Posts: 155
Joined: Sat Jan 19, 2013 3:57 am

Re: Strange fuzziness when animating sprite

Post by szensk »

LuaJIT will gladly inline math.floor into SSE instructions if it's in a hotloop, don't worry about its impact on performance.
Post Reply

Who is online

Users browsing this forum: Roland Chastain, slime and 195 guests