Page 1 of 1

color mask with alpha

Posted: Wed Aug 26, 2009 9:19 pm
by delavega
Hello, i've just discovered Löve today... and it really looks amazing :)
I'm quite familiar with scripting languages but it's my first attempt on Lua. I've checked some examples and tutorials but i haven't found (yet?) a way to simulate a fake 3d fog effect.
So, i have a sprite, which is a tree over an empty plain. I can scale it down to make it look far but i want to cover it step by step with light cyan also.
I don't know if i can use the same png image as a light cyan mask and display it with alpha, or is there a better way to do this with Löve ?
Thanks for help.

Re: color mask with alpha

Posted: Wed Aug 26, 2009 10:51 pm
by osgeld
love.graphics.setColorMode(love.color_modulate)

after this is called you should be able to define a color and use it on your image

Re: color mask with alpha

Posted: Thu Aug 27, 2009 12:32 am
by Almost
What he said.

love.graphics.setColorMode(love.color_modulate)

means that from that point on any image you draw is tinted by the current color ( love.graphics.setColor() )
so to make an image more blue you would make the color less red and less green (128,255,128,255)

if you want other images to be drawn normal just set ColorMode to love.color_normal after you're done drawing this tinted image, or set the color to white(full color) before you draw them

Re: color mask with alpha

Posted: Thu Aug 27, 2009 12:56 pm
by delavega
thank you, that works perfectly !