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.
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
Strange fuzziness when animating sprite
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 2
- Joined: Sun Dec 21, 2014 7:14 pm
Strange fuzziness when animating sprite
- Attachments
-
- billy.love
- (297.38 KiB) Downloaded 153 times
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Strange fuzziness when animating sprite
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)
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)
-
- Prole
- Posts: 2
- Joined: Sun Dec 21, 2014 7:14 pm
Re: Strange fuzziness when animating sprite
Perfect! That fixed everything. Thank you very much.
Re: Strange fuzziness when animating sprite
LuaJIT will gladly inline math.floor into SSE instructions if it's in a hotloop, don't worry about its impact on performance.
Who is online
Users browsing this forum: No registered users and 8 guests