The process is to use surfaces, then apply blend mode to subtract a flashlight radius to get visible parts. But im unable to use it in love2D.
Im tried using these codes:
Code: Select all
love.graphics.setBlendMode("alpha")
love.graphics.setColor(255,255,255,255)
love.graphics.draw(images.bg,width/2 - images.bg:getWidth()/2,height/2 - images.bg:getHeight()/2)
love.graphics.setBlendMode("subtract")
love.graphics.setColor(255,255,255,255)
love.graphics.draw(images.light,love.mouse.getX() * (width/sWidth),love.mouse.getY()* (height/sHeight))