mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-24 14:39:03 -06:00
Compare commits
No commits in common. "9fc7e4b1eb715afe60fc271aac6e03ba435879ac" and "a83829443592da56d9aff8dfaa37f00b60ef5849" have entirely different histories.
9fc7e4b1eb
...
a838294435
@ -334,16 +334,7 @@ end
|
|||||||
|
|
||||||
function GameMode:onGameOver()
|
function GameMode:onGameOver()
|
||||||
switchBGM(nil)
|
switchBGM(nil)
|
||||||
local alpha = 0
|
love.graphics.setColor(0, 0, 0, 1 - 2 ^ (-self.game_over_frames / 30))
|
||||||
local animation_length = 120
|
|
||||||
if self.game_over_frames < animation_length then
|
|
||||||
-- Show field for a bit, then fade out.
|
|
||||||
alpha = math.pow(2048, self.game_over_frames/animation_length - 1)
|
|
||||||
elseif self.game_over_frames < 2 * animation_length then
|
|
||||||
-- Keep field hidden for a short time, then pop it back in (for screenshots).
|
|
||||||
alpha = 1
|
|
||||||
end
|
|
||||||
love.graphics.setColor(0, 0, 0, alpha)
|
|
||||||
love.graphics.rectangle(
|
love.graphics.rectangle(
|
||||||
"fill", 64, 80,
|
"fill", 64, 80,
|
||||||
16 * self.grid.width, 16 * (self.grid.height - 4)
|
16 * self.grid.width, 16 * (self.grid.height - 4)
|
||||||
@ -612,8 +603,18 @@ function GameMode:animation(x, y, skin, colour)
|
|||||||
if self.last_lcd ~= 0 then
|
if self.last_lcd ~= 0 then
|
||||||
progress = (self.last_lcd - self.lcd) / self.last_lcd
|
progress = (self.last_lcd - self.lcd) / self.last_lcd
|
||||||
end
|
end
|
||||||
-- Convert progress through the animation into an alpha value, with easing
|
-- Change this number to change "bounciness"
|
||||||
local alpha = 1 - progress ^ 2
|
local bounce = 13
|
||||||
|
-- Convert progress through the animation into an alpha value
|
||||||
|
local alpha = 0
|
||||||
|
-- Cutoff is arbitrary: corresponds to level 500 in Marathon A2
|
||||||
|
if self.last_lcd > 25 then
|
||||||
|
-- Goes up and down: looks better when animation is long
|
||||||
|
alpha = 1 - (bounce * progress^3 - 1.5 * bounce * progress^2 + (0.5 * bounce + 1) * progress)
|
||||||
|
else
|
||||||
|
-- Always decreasing: looks better when animation is short
|
||||||
|
alpha = 1 - progress * progress
|
||||||
|
end
|
||||||
return {
|
return {
|
||||||
1, 1, 1,
|
1, 1, 1,
|
||||||
alpha,
|
alpha,
|
||||||
@ -631,26 +632,7 @@ function GameMode:drawLineClearAnimation()
|
|||||||
-- params: block x, y, skin, colour
|
-- params: block x, y, skin, colour
|
||||||
-- returns: table with RGBA, skin, colour, x, y
|
-- returns: table with RGBA, skin, colour, x, y
|
||||||
|
|
||||||
-- Quadratic Fadeout (default)
|
-- Flashy Fadeout (default)
|
||||||
--[[
|
|
||||||
function animation(x, y, skin, colour)
|
|
||||||
-- Animation progress where 0 = start and 1 = end
|
|
||||||
local progress = 1
|
|
||||||
if self.last_lcd ~= 0 then
|
|
||||||
progress = (self.last_lcd - self.lcd) / self.last_lcd
|
|
||||||
end
|
|
||||||
-- Convert progress through the animation into an alpha value, with easing
|
|
||||||
local alpha = 1 - progress ^ 2
|
|
||||||
return {
|
|
||||||
1, 1, 1,
|
|
||||||
alpha,
|
|
||||||
skin, colour,
|
|
||||||
48 + x * 16, y * 16
|
|
||||||
}
|
|
||||||
end
|
|
||||||
--]]
|
|
||||||
|
|
||||||
-- Flashy Fadeout
|
|
||||||
--[[
|
--[[
|
||||||
function animation(x, y, skin, colour)
|
function animation(x, y, skin, colour)
|
||||||
-- Animation progress where 0 = start and 1 = end
|
-- Animation progress where 0 = start and 1 = end
|
||||||
|
Loading…
Reference in New Issue
Block a user