add flash frames
This commit is contained in:
parent
e487ceaec8
commit
beb5df6613
1 changed files with 19 additions and 0 deletions
19
main.lua
19
main.lua
|
|
@ -34,6 +34,9 @@ function love.load()
|
||||||
-- dt * slow_amnt
|
-- dt * slow_amnt
|
||||||
slow_amnt = 1
|
slow_amnt = 1
|
||||||
|
|
||||||
|
-- flash frames
|
||||||
|
flash_frames = nil
|
||||||
|
|
||||||
-- global timer
|
-- global timer
|
||||||
timer = Timer()
|
timer = Timer()
|
||||||
|
|
||||||
|
|
@ -126,6 +129,16 @@ end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
if current_room then current_room:draw() end
|
if current_room then current_room:draw() end
|
||||||
|
|
||||||
|
if flash_frames then
|
||||||
|
flash_frames = flash_frames - 1
|
||||||
|
if flash_frames == -1 then flash_frames = nil end
|
||||||
|
end
|
||||||
|
if flash_frames then
|
||||||
|
love.graphics.setColor(COLORS.bg)
|
||||||
|
love.graphics.rectangle('fill', 0, 0, sx*gw, sy*gh)
|
||||||
|
love.graphics.setColor(COLORS.default)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---Enumerates files in a folder and inserts them to a provided table.
|
---Enumerates files in a folder and inserts them to a provided table.
|
||||||
|
|
@ -184,6 +197,12 @@ function slow(amount, duration)
|
||||||
timer:tween(duration, _G, {slow_amnt = 1}, 'in-out-cubic')
|
timer:tween(duration, _G, {slow_amnt = 1}, 'in-out-cubic')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Flashes the screen for a set amount of frames
|
||||||
|
---@param frames number
|
||||||
|
function flash(frames)
|
||||||
|
flash_frames = frames
|
||||||
|
end
|
||||||
|
|
||||||
---Generates and returns random UUID string
|
---Generates and returns random UUID string
|
||||||
---@return string
|
---@return string
|
||||||
function UUID()
|
function UUID()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue