rokit boy wrote: What i am trying to achive is that when i draw the transparent square (the black one) over the red one, it'll make it so you cant see the red one, but see the background.
Code: Select all
alpha1 = 255
function love.draw()
love.graphics.setBackgroundColor(255,255,255) -- set background color to white so we can see what we're doing
love.graphics.setColor(0,255,0) -- green
love.graphics.polygon('fill', 100, 100, 200, 100, 150, 200) -- draw a triangle
love.graphics.setColor(0,0,0,alpha1) -- black, with a variable defined with our alpha (transparency)
love.graphics.rectangle("fill",100,100,100,100) -- a square
if viewBlock == 1 then
love.graphics.setColor(255,0,0,50) -- red, with a little bit of alpha just for illustration; 0 = transparent
love.graphics.rectangle("fill",100,100,100,100) -- a square
end
end
function love.keypressed(key)
-- press A or B to switch the block transparencies
if key == "a" then
alpha1 = 255
viewBlock = 0
end
if key == "b" then
alpha1 = 0
viewBlock = 1
end
end