Page 1 of 1

Having Trouble Making an Image Transparent [Solved]

Posted: Mon Jan 14, 2019 9:35 am
by ARBTECH
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!

Re: Having Trouble Making an Image Transparent

Posted: Mon Jan 14, 2019 9:56 am
by Nixola
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.

Re: Having Trouble Making an Image Transparent

Posted: Mon Jan 14, 2019 10:05 am
by ARBTECH
Thank you so much! I should have paid more attention to wiki! :death: