From 40a2e78280ad4f33d7790998a7563744c46d5f6c Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 6 Dec 2020 11:38:45 -0500 Subject: [PATCH] Marathon 2020 section colour function fixed --- tetris/modes/gamemode.lua | 6 ++++++ tetris/modes/marathon_2020.lua | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 8ba4d0e..1cce7a1 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -524,6 +524,10 @@ function GameMode:drawSectionTimes(current_section) love.graphics.printf(formatTime(self.frames - self.section_start_time), section_x, 40 + 20 * current_section, 90, "left") end +function GameMode:sectionColourFunction(section) + return { 1, 1, 1, 1 } +end + function GameMode:drawSectionTimesWithSecondary(current_section) local section_x = 530 local section_secondary_x = 440 @@ -535,9 +539,11 @@ function GameMode:drawSectionTimesWithSecondary(current_section) end for section, time in pairs(self.secondary_section_times) do + love.graphics.setColor(self:sectionColourFunction(section)) if section > 0 then love.graphics.printf(formatTime(time), section_secondary_x, 40 + 20 * section, 90, "left") end + love.graphics.setColor(1, 1, 1, 1) end local current_x diff --git a/tetris/modes/marathon_2020.lua b/tetris/modes/marathon_2020.lua index 22d4adc..f192f6f 100644 --- a/tetris/modes/marathon_2020.lua +++ b/tetris/modes/marathon_2020.lua @@ -423,6 +423,14 @@ function Marathon2020Game:drawGrid() end end +function Marathon2020Game:sectionColourFunction(section) + if self.section_status[section] == "cool" then + return { 0, 1, 0, 1 } + else + return { 1, 1, 1, 1 } + end +end + function Marathon2020Game:drawScoringInfo() Marathon2020Game.super.drawScoringInfo(self)