mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
just a touch up
This commit is contained in:
parent
5351b91168
commit
b759a0670a
19
lib/init.lua
19
lib/init.lua
@ -58,9 +58,6 @@ function light_world:init(options)
|
|||||||
self.glowTimer = 0.0
|
self.glowTimer = 0.0
|
||||||
self.glowDown = false
|
self.glowDown = false
|
||||||
|
|
||||||
self.drawBackground = function() end
|
|
||||||
self.drawForeground = function() end
|
|
||||||
|
|
||||||
options = options or {}
|
options = options or {}
|
||||||
for k, v in pairs(options) do self[k] = v end
|
for k, v in pairs(options) do self[k] = v end
|
||||||
|
|
||||||
@ -164,14 +161,12 @@ function light_world:drawGlow(l,t,w,h,s)
|
|||||||
util.drawto(self.glowMap, l, t, s, function()
|
util.drawto(self.glowMap, l, t, s, function()
|
||||||
if self.glowDown then
|
if self.glowDown then
|
||||||
self.glowTimer = math.max(0.0, self.glowTimer - love.timer.getDelta())
|
self.glowTimer = math.max(0.0, self.glowTimer - love.timer.getDelta())
|
||||||
if self.glowTimer == 0.0 then
|
|
||||||
self.glowDown = not self.glowDown
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
self.glowTimer = math.min(self.glowTimer + love.timer.getDelta(), 1.0)
|
self.glowTimer = math.min(self.glowTimer + love.timer.getDelta(), 1.0)
|
||||||
if self.glowTimer == 1.0 then
|
|
||||||
self.glowDown = not self.glowDown
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.glowTimer == 1.0 or self.glowTimer == 0.0 then
|
||||||
|
self.glowDown = not self.glowDown
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, #self.body do
|
for i = 1, #self.body do
|
||||||
@ -253,14 +248,6 @@ function light_world:clearBodies()
|
|||||||
self.isReflection = false
|
self.isReflection = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function light_world:setBackgroundMethod(fn)
|
|
||||||
self.drawBackground = fn or function() end
|
|
||||||
end
|
|
||||||
|
|
||||||
function light_world:setForegroundMethod(fn)
|
|
||||||
self.drawForeground = fn or function() end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set ambient color
|
-- set ambient color
|
||||||
function light_world:setAmbientColor(red, green, blue)
|
function light_world:setAmbientColor(red, green, blue)
|
||||||
self.ambient = {red, green, blue}
|
self.ambient = {red, green, blue}
|
||||||
|
Loading…
Reference in New Issue
Block a user