Is there any way to make translucent sprites in Love2d?

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
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Is there any way to make translucent sprites in Love2d?

Post by pauljessup »

You know, partially see through ones...like a ghost, etc. I want to use this mainly for a fog effect....
User avatar
CaptainMaelstrom
Party member
Posts: 161
Joined: Sat Jan 05, 2013 10:38 pm

Re: Is there any way to make translucent sprites in Love2d?

Post by CaptainMaelstrom »

love.graphics.setColor(255,255,255,127)
love.graphics.draw(yourSprite,50,50)

The 127, the fourth parameter in setColor is the alpha parameter which makes things translucent. 255 is opaque, 0 is completely invisible.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Is there any way to make translucent sprites in Love2d?

Post by pauljessup »

Hmm. Tried that earlier, but didn't seem to work. Might be a variable not being set. Will try again, thanks!
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Is there any way to make translucent sprites in Love2d?

Post by pauljessup »

Yeah, forced it to a certain value rather than using a variable being called from another function- it worked. So, thanks :)
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Is there any way to make translucent sprites in Love2d?

Post by raidho36 »

Not that it's related, but what you mean is transparent and not translucent. Transparent objects would partially blend their own color to background color, while translucent objects only alter background color by subtracting some amount of light from it, they don't have their own color. Latter is acheivable, too, through "multiplication" blend mode.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 54 guests