Change fade to grey to not use a tween
parent
a6febca64e
commit
22ce65d003
26
main.lua
26
main.lua
|
|
@ -305,7 +305,7 @@ function love.load(arg)
|
||||||
|
|
||||||
game.game_over_image = love.graphics.newImage('images/game_over.png')
|
game.game_over_image = love.graphics.newImage('images/game_over.png')
|
||||||
game.game_over = false
|
game.game_over = false
|
||||||
game.fade_to_grey_tween = {p = 1.0}
|
game.fade_to_grey = {time = 0, duration = 120, progress = 0.0}
|
||||||
game.paused = false
|
game.paused = false
|
||||||
game.frame_by_frame = false
|
game.frame_by_frame = false
|
||||||
|
|
||||||
|
|
@ -426,15 +426,13 @@ function love.load(arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
if game.game_over and game.fade_to_grey_tween.p < 1.0 then
|
if game.game_over then
|
||||||
game.fade_to_grey_tween.t = game.fade_to_grey_tween.t + 1
|
if game.fade_to_grey.time < game.fade_to_grey.duration then
|
||||||
game.fade_to_grey_tween.p = easing.linear(
|
game.fade_to_grey.time = game.fade_to_grey.time + 1
|
||||||
game.fade_to_grey_tween.t,
|
game.fade_to_grey.progress =
|
||||||
game.fade_to_grey_tween.b,
|
game.fade_to_grey.time / game.fade_to_grey.duration
|
||||||
game.fade_to_grey_tween.c,
|
game.shader:send("progress", game.fade_to_grey.progress)
|
||||||
game.fade_to_grey_tween.d
|
end
|
||||||
)
|
|
||||||
game.shader:send("progress", game.fade_to_grey_tween.p)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if game.paused or game.game_over then
|
if game.paused or game.game_over then
|
||||||
|
|
@ -475,7 +473,8 @@ function love.update(dt)
|
||||||
if game.bubble_slots[i].bubble_type ~= 0 and
|
if game.bubble_slots[i].bubble_type ~= 0 and
|
||||||
game.bubble_slots[i].y > game.level_bottom then
|
game.bubble_slots[i].y > game.level_bottom then
|
||||||
game.game_over = true
|
game.game_over = true
|
||||||
game.fade_to_grey_tween = {t = 0, d = 120, b = 0, c = 1, p = 0.0}
|
game.fade_to_grey.time = 0
|
||||||
|
game.fade_to_grey.progress = 0.0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if game.game_over then
|
if game.game_over then
|
||||||
|
|
@ -523,7 +522,8 @@ function love.update(dt)
|
||||||
|
|
||||||
if #matches < 3 and game.current_bubble.y > game.level_bottom then
|
if #matches < 3 and game.current_bubble.y > game.level_bottom then
|
||||||
game.game_over = true
|
game.game_over = true
|
||||||
game.fade_to_grey_tween = {t = 0, d = 120, b = 0, c = 1, p = 0.0}
|
game.fade_to_grey.time = 0
|
||||||
|
game.fade_to_grey.progress = 0.0
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -864,7 +864,7 @@ function love.draw(alpha)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- draw game over
|
-- draw game over
|
||||||
if game.game_over and game.fade_to_grey_tween.p == 1.0 then
|
if game.game_over and game.fade_to_grey.progress == 1.0 then
|
||||||
love.graphics.setColor(0, 0, 0, 0.8)
|
love.graphics.setColor(0, 0, 0, 0.8)
|
||||||
love.graphics.rectangle(
|
love.graphics.rectangle(
|
||||||
'fill',
|
'fill',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue