I've been working on my latest game in none other than the wonderous Löve, and I've come across a strange glitch. Some of my sprites have thin magenta borders around them, while other do not. I am using magenta as the transparency color, but the other parts that are magenta are transparent as they should be. I am using mtPaint to create my images (.png).
Here's an example:
(The guy on the top's x/y/a is connected to a physics object, the bottom is a static sprite, both are drawn from love.graphics.draw(sprite,x,y,a) with the same Image object)
Is this because of the way I'm making the actual image? Or is it a Löve/Lua/OpenGL issue? Any way to fix it?
Are the bordered images JPG? (Well, if you say PNG, apparently not)
Please upload a working and a not-working image.
Curiosity: Why do you use a color instead of real transparency?
PS: Perhaps it has to do with 'indexed' status of the images.
PPS: Maybe uploading the code would help too.
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
This is probably due to how PNG handles transparent textures when scaled/rotated/translated. I added a feature a while back (which noone cared about at the time) which took care of this problem. I tested it a while ago, and it seems to be broken in 0.5.0. Typical.
You can try it if you want, maybe I'm mistaken. Load the image like this:
If you math.floor the x,y-position before drawing the sprite, the problem will go away, though. (Unless you scale/rotate it). Of course, that will also lead to non-smooth movement.
Gimp has an option to convert a color to alpha, don't know exactly if it works as you need it to, it is located under color (and is called color to alpha, or something similar).
bartbes wrote:Gimp has an option to convert a color to alpha, don't know exactly if it works as you need it to, it is located under color (and is called color to alpha, or something similar).
I do it by right-clicking the layer (in the layer dialog) and clicking "add alpha to layer" then, when you erase or delete (DEL) pixels, they are transparent.
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)