Changes on Lights
- adjusted lights so they are called to do something, instead of it being handled on game world - lights has only coordinate arguments + a table with all other optional ones. - renamed a lot of lights components to radius instaed of range, as it was agreed before elsewhere
This commit is contained in:
@@ -79,19 +79,7 @@ function drawGameworldDarkness()
|
||||
love.graphics.setBlendMode("replace")
|
||||
love.graphics.setColor(0,0,0,0)
|
||||
for _, light in pairs(LoadedObjects.Lights) do
|
||||
if light.range ~= 0 then
|
||||
local position = {
|
||||
x = (light.pos.x - Camera.pos.x) / game.scale,
|
||||
y = (light.pos.y - Camera.pos.y) / game.scale
|
||||
}
|
||||
local range = (light.range + light.flicker_value) / game.scale
|
||||
love.graphics.circle(
|
||||
"fill",
|
||||
position.x,
|
||||
position.y,
|
||||
range
|
||||
)
|
||||
end
|
||||
light:drawClear()
|
||||
end
|
||||
Canvas.Darkness:endDrawing()
|
||||
Canvas.Darkness:draw()
|
||||
@@ -99,23 +87,7 @@ end
|
||||
|
||||
function drawGameworldLights()
|
||||
for _, light in pairs(LoadedObjects.Lights) do
|
||||
if light.range ~= 0 then
|
||||
love.graphics.setColor(light.color[1],light.color[2],light.color[3],1)
|
||||
|
||||
shader.circle_gradient:send("pos_x",- Camera.pos.x + light.pos.x)
|
||||
shader.circle_gradient:send("pos_y",- Camera.pos.y + light.pos.y)
|
||||
shader.circle_gradient:send("range",light.range)
|
||||
shader.circle_gradient:send("scale",game.scale)
|
||||
|
||||
love.graphics.setShader(shader.circle_gradient)
|
||||
love.graphics.circle(
|
||||
"fill",
|
||||
- Camera.pos.x + light.pos.x,
|
||||
- Camera.pos.y + light.pos.y,
|
||||
light.range
|
||||
)
|
||||
love.graphics.setShader()
|
||||
end
|
||||
light:drawShine()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user