Page 1 of 1

Draw a sprite white

Posted: Thu Feb 21, 2013 9:35 am
by Gurrlin
Hi!

I'm working on making units flash red and white when taking damage. I don't have any problems drawing them red using the alpha blend mode and setColor but I can't figure out how to be able to draw them completely white.

Re: Draw a sprite white

Posted: Thu Feb 21, 2013 10:58 am
by Robin
setColor to white with the default blend mode should work. If that doesn't, please upload your .love so we can do more to help you.

Re: Draw a sprite white

Posted: Thu Feb 21, 2013 3:35 pm
by Germanunkol
If you use love.graphics.setColor and set it to 255,255,255 then Löve will draw them in their original colors. Try 254,254,254 instead - the difference should not be noticable by the naked eye.

Re: Draw a sprite white

Posted: Thu Feb 21, 2013 4:52 pm
by Gurrlin
@ Robin
Thats what love uses as standard and as Germanunkol said there won't be any difference.

@Germanunkol
Sorry, but how would that help?

I've uploaded a small example so you can try it out yourself.

EDIT: Ops failed with the .love, try this one instead.
EDIT2: Okey still failing, OT how do I require files correctly when making .love files?

Re: Draw a sprite white

Posted: Thu Feb 21, 2013 6:11 pm
by Germanunkol
Sorry, my remark was nonesense. Setting it to a bright color just makes it display the normal way.

You could just use two images and swap them out?

Re: Draw a sprite white

Posted: Thu Feb 21, 2013 8:56 pm
by Qcode
Sometimes requiring files isn't case-sensitive until you zip the files. That was the case with this. You put require "AnAl" when the file is AnAL.
New file with this fixed.

Re: Draw a sprite white

Posted: Mon Feb 25, 2013 1:22 pm
by Gurrlin
Thanks Qcode!

@Germanunkol, that is a solution, however in this case that would mean double sets of animations which are big on their own. I'm pretty sure you can do it with code.

Re: Draw a sprite white

Posted: Tue Feb 26, 2013 4:54 pm
by SiENcE
Gurrlin wrote:Thanks Qcode!

@Germanunkol, that is a solution, however in this case that would mean double sets of animations which are big on their own. I'm pretty sure you can do it with code.
Nope, i had a similar problem and replace ('Replace color mode. Images (etc) will not be affected by current color.') don't affect images.

You can do this only via shader (pixeleffect).

Re: Draw a sprite white

Posted: Tue Feb 26, 2013 10:45 pm
by Zeliarden
You can do it with mapPixel
press "x" for damage

Re: Draw a sprite white

Posted: Wed Feb 27, 2013 10:06 am
by Gurrlin
Thanks Zeliarden, that's just what I was looking for! I had no idea it existed, time to get some serious feedback implemented! :)