Draw a sprite white

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
Gurrlin
Prole
Posts: 6
Joined: Mon Dec 17, 2012 6:11 pm

Draw a sprite white

Post 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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Draw a sprite white

Post 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.
Help us help you: attach a .love.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Draw a sprite white

Post 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.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Gurrlin
Prole
Posts: 6
Joined: Mon Dec 17, 2012 6:11 pm

Re: Draw a sprite white

Post 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?
Attachments
Animation Tool.love
(198.92 KiB) Downloaded 181 times
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Draw a sprite white

Post 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?
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
Qcode
Party member
Posts: 170
Joined: Tue Jan 10, 2012 1:35 am

Re: Draw a sprite white

Post 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.
Gurrlin
Prole
Posts: 6
Joined: Mon Dec 17, 2012 6:11 pm

Re: Draw a sprite white

Post 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.
User avatar
SiENcE
Party member
Posts: 805
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Draw a sprite white

Post 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).
Zeliarden
Party member
Posts: 139
Joined: Tue Feb 28, 2012 4:40 pm

Re: Draw a sprite white

Post by Zeliarden »

You can do it with mapPixel
press "x" for damage
Attachments
Animation Tool.love
mapPixel
(199.4 KiB) Downloaded 266 times
Gurrlin
Prole
Posts: 6
Joined: Mon Dec 17, 2012 6:11 pm

Re: Draw a sprite white

Post 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! :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests