Custom line clear animations

This commit is contained in:
Ishaan Bhardwaj 2021-02-10 23:10:10 -05:00
parent b644c8e457
commit acb05918c1

View File

@ -537,13 +537,22 @@ function GameMode:getHighScoreData()
} }
end end
function GameMode:animation(x, y, skin, colour)
return {
1, 1, 1,
-0.25 + 1.25 * (self.lcd / self:getLineClearDelay()),
skin, colour,
48 + x * 16, y * 16
}
end
function GameMode:drawLineClearAnimation() function GameMode:drawLineClearAnimation()
-- animation function -- animation function
-- 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
-- Fadeout (default) -- Fadeout (default)
-- [[ --[[
function animation(x, y, skin, colour) function animation(x, y, skin, colour)
return { return {
1, 1, 1, 1, 1, 1,
@ -585,7 +594,7 @@ function GameMode:drawLineClearAnimation()
for y, row in pairs(self.cleared_block_table) do for y, row in pairs(self.cleared_block_table) do
for x, block in pairs(row) do for x, block in pairs(row) do
local animation_table = animation(x, y, block.skin, block.colour) local animation_table = self:animation(x, y, block.skin, block.colour)
love.graphics.setColor( love.graphics.setColor(
animation_table[1], animation_table[2], animation_table[1], animation_table[2],
animation_table[3], animation_table[4] animation_table[3], animation_table[4]