Lights = {} LightTimer = 0 function CreateDarkness() return love.graphics.newCanvas(game.width/2, game.height/2) end function CreateLight(x,y,range) local o = {} o.pos = { x = x, y = y } o.range = range o.flicker = 0 table.insert(Lights,o) return o end function DoDarkness() love.graphics.setColor(0,0,0) love.graphics.rectangle("fill",0,0,game.width,game.height) end function DoLights() LightTimer = LightTimer + 1 if LightTimer >= 3 then LightTimer = LightTimer - 3 for _, light in pairs(Lights) do light.flicker = math.random(-1,1) end end love.graphics.setBlendMode("replace") -- first, border love.graphics.setColor(1,1,1) for _, light in pairs(Lights) do love.graphics.circle( "fill", light.pos.x - Camera.pos.x, light.pos.y - Camera.pos.y, light.range + light.flicker + 1 ) end love.graphics.setColor(0,0,0,0) -- then, light for _, light in pairs(Lights) do love.graphics.circle( "fill", light.pos.x - Camera.pos.x, light.pos.y - Camera.pos.y, light.range + light.flicker ) end love.graphics.setBlendMode("alpha") end function DoBorder() end function DrawDarkness() love.graphics.draw(Canvas.Darkness, 0, 0, 0, 1, 1) end