From acb05918c11d2e3130fbb7ec1a320bf5f78207df Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Wed, 10 Feb 2021 23:10:10 -0500 Subject: [PATCH] Custom line clear animations --- tetris/modes/gamemode.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 8780470..95cc4ff 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -537,13 +537,22 @@ function GameMode:getHighScoreData() } 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() -- animation function -- params: block x, y, skin, colour -- returns: table with RGBA, skin, colour, x, y -- Fadeout (default) - -- [[ + --[[ function animation(x, y, skin, colour) return { 1, 1, 1, @@ -585,7 +594,7 @@ function GameMode:drawLineClearAnimation() for y, row in pairs(self.cleared_block_table) 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( animation_table[1], animation_table[2], animation_table[3], animation_table[4]