mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 03:39:03 -06:00
Compare commits
No commits in common. "a83829443592da56d9aff8dfaa37f00b60ef5849" and "c1693524d797ac0a02b2e9564c10e98d2aa24833" have entirely different histories.
a838294435
...
c1693524d7
@ -598,28 +598,11 @@ function GameMode:getHighScoreData()
|
||||
end
|
||||
|
||||
function GameMode: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
|
||||
-- Change this number to change "bounciness"
|
||||
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 {
|
||||
1, 1, 1,
|
||||
alpha,
|
||||
skin, colour,
|
||||
48 + x * 16, y * 16
|
||||
1, 1, 1,
|
||||
-0.25 + 1.25 * (self.lcd / self.last_lcd),
|
||||
skin, colour,
|
||||
48 + x * 16, y * 16
|
||||
}
|
||||
end
|
||||
|
||||
@ -631,37 +614,8 @@ function GameMode:drawLineClearAnimation()
|
||||
-- animation function
|
||||
-- params: block x, y, skin, colour
|
||||
-- returns: table with RGBA, skin, colour, x, y
|
||||
|
||||
-- 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
|
||||
-- Change this number to change "bounciness"
|
||||
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 {
|
||||
1, 1, 1,
|
||||
alpha,
|
||||
skin, colour,
|
||||
48 + x * 16, y * 16
|
||||
}
|
||||
end
|
||||
--]]
|
||||
|
||||
-- Fadeout
|
||||
|
||||
-- Fadeout (default)
|
||||
--[[
|
||||
function animation(x, y, skin, colour)
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user