## Having Trouble Making an Image Transparent [Solved]

General discussion about LÖVE, Lua, game development, puns, and unicorns.
ARBTECH
Prole
Posts: 6
Joined: Mon Jan 14, 2019 9:25 am

### Having Trouble Making an Image Transparent [Solved]

Hi ! I'm new to love and i'm trying to make my png image transparent using code in love. this is my code:

Code: Select all

function love.load()

Image = love.graphics.newImage("love-big-ball.png")

end

function love.draw()

love.graphics.setColor(255, 255, 255, 50)
love.graphics.draw(Image, 50, 50)

end
what am i doing wrong here? if i set the alpha value to 0, the image completely disappears. And when i set it on any other value, it becomes fully visible, with no transparency!
Last edited by ARBTECH on Mon Jan 14, 2019 11:18 am, edited 1 time in total.

Nixola
Inner party member
Posts: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

### Re: Having Trouble Making an Image Transparent

Hi, welcome to the forums!
Since LÖVE 11, the values in setColor are now decimal numbers between 0 and 1, meaning that in order to make it transparent you'd need to call lg.setColor(1, 1, 1, 1/5) or similar.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

ARBTECH
Prole
Posts: 6
Joined: Mon Jan 14, 2019 9:25 am

### Re: Having Trouble Making an Image Transparent

Thank you so much! I should have paid more attention to wiki!

### Who is online

Users browsing this forum: pgimeno and 10 guests