color mask with alpha

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
User avatar
delavega
Prole
Posts: 2
Joined: Wed Aug 26, 2009 8:18 pm

color mask with alpha

Post 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.
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: color mask with alpha

Post 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
User avatar
Almost
Prole
Posts: 42
Joined: Fri Aug 21, 2009 8:04 pm
Location: Canada
Contact:

Re: color mask with alpha

Post 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
User avatar
delavega
Prole
Posts: 2
Joined: Wed Aug 26, 2009 8:18 pm

Re: color mask with alpha

Post by delavega »

thank you, that works perfectly !
Post Reply

Who is online

Users browsing this forum: No registered users and 226 guests