Page 1 of 1

Weird effect on sprites while moving

Posted: Mon Apr 16, 2018 8:48 am
by Urvorn
Hello everyone !

So currently I'm trying to create a Space Invaders clone but I have a problem that I don't seen before.
When my sprites are moving there is a weird effect on the borders. When I've created the sprites I have set a background color and make it transparent and this the problem : sometimes when the sprites are moving we can see the background color of my sprites and it should not happen.

Sorry for the title of this topic but I don't know the problem so I try to be as precise as possible. And also I don't know how to create screenshots with LOVE.

Thank you by advance.

Here is the code :

https://pastebin.com/tYtekk5G

Re: Weird effect on sprites while moving

Posted: Mon Apr 16, 2018 9:25 am
by zorg
if you're on windows, Alt + PrintScreen while having the löve window focused, should take a screenshot of the window's contents, then you can paste that into mspaint, save, upload and that's basically it. Edit: effort: A, reading comprehension: D-- .P

Also, show code (in [ code ] [ /code ] tags), and images. :3

Re: Weird effect on sprites while moving

Posted: Mon Apr 16, 2018 9:48 am
by Urvorn
Hey thank you for your quick reply !

I've updated the first comment to show the code but the screenshots are not really good you will see nothing.

Re: Weird effect on sprites while moving

Posted: Mon Apr 16, 2018 10:13 am
by grump
It's kind of hard to analyze a problem when you're unable to show what the problem is.

Taking a wild guess from your description: it may be caused by drawing the sprites at non-integer coordinates. Try rounding the sprite positions to the nearest integer coords in love.draw.

Code: Select all

love.graphics.draw(hero.image, math.floor(hero.x + .5), math.floor(hero.y + .5))

Re: Weird effect on sprites while moving

Posted: Mon Apr 16, 2018 10:22 am
by zorg
Also, don't forget to do the same for the enemies as well, and probably the bullets too.

Re: Weird effect on sprites while moving

Posted: Mon Apr 16, 2018 10:50 am
by Urvorn
Ok thank you I will try. But the screenshots don't work, they show my entire screen...

Re: Weird effect on sprites while moving

Posted: Mon Apr 16, 2018 11:00 am
by grump
Crop it in mspaint, or do as zorg said, use Alt+PrintScreen. That will only capture the active window.