cambridge-modpack/tetris/modes/4wide.lua

88 lines
2.4 KiB
Lua
Raw Normal View History

2020-11-11 21:24:56 -06:00
require 'funcs'
local SurvivalA3Game = require 'tetris.modes.survival_a3'
2021-01-11 14:25:15 -06:00
local Grid = require 'tetris.components.grid'
2020-11-11 21:24:56 -06:00
local FourWideGame = SurvivalA3Game:extend()
FourWideGame.name = "4-wide Simulator"
FourWideGame.hash = "4wide"
FourWideGame.tagline = "The board has gotten narrower! Can you survive the increasing speeds?"
2021-02-22 10:20:31 -06:00
function FourWideGame:new()
SurvivalA3Game:new()
end
2020-11-11 21:24:56 -06:00
function FourWideGame:initialize(ruleset)
self.super:initialize(ruleset)
2021-01-11 14:46:30 -06:00
self.grid = Grid(4, 24)
2020-11-11 21:24:56 -06:00
end
2021-01-11 14:25:15 -06:00
local function getLetterGrade(grade)
if grade == 0 then
return "1"
else
return "S" .. tostring(grade)
end
end
function FourWideGame:drawScoringInfo()
2021-07-11 22:22:16 -05:00
-- hack to disable big mode roll
self.big_mode = false
2021-01-11 14:25:15 -06:00
love.graphics.setColor(1, 1, 1, 1)
local text_x = 160
love.graphics.setFont(font_3x5_2)
2021-07-11 22:22:16 -05:00
if config["side_next"] then
love.graphics.printf("NEXT", 240, 72, 40, "left")
else
love.graphics.printf("NEXT", 64, 40, 40, "left")
end
love.graphics.print(
self.das.direction .. " " ..
self.das.frames .. " " ..
strTrueValues(self.prev_inputs)
)
2021-01-11 14:25:15 -06:00
love.graphics.printf("GRADE", text_x, 120, 40, "left")
love.graphics.printf("SCORE", text_x, 200, 40, "left")
love.graphics.printf("LEVEL", text_x, 320, 40, "left")
local sg = self.grid:checkSecretGrade()
if sg >= 5 then
love.graphics.printf("SECRET GRADE", 240, 430, 180, "left")
end
if(self.coolregret_timer > 0) then
love.graphics.printf(self.coolregret_message, 64, 400, 160, "center")
self.coolregret_timer = self.coolregret_timer - 1
end
local current_section = math.floor(self.level / 100) + 1
self:drawSectionTimesWithSplits(current_section)
love.graphics.setFont(font_3x5_3)
if self.roll_frames > 3238 then love.graphics.setColor(1, 0.5, 0, 1)
2021-07-11 22:22:16 -05:00
elseif self.level >= 1300 then love.graphics.setColor(0, 1, 0, 1) end
2021-01-11 14:25:15 -06:00
love.graphics.printf(getLetterGrade(math.floor(self.grade)), text_x, 140, 90, "left")
love.graphics.setColor(1, 1, 1, 1)
love.graphics.printf(self.score, text_x, 220, 90, "left")
love.graphics.printf(self.level, text_x, 340, 50, "right")
if self.clear then
love.graphics.printf(self.level, text_x, 370, 50, "right")
else
love.graphics.printf(math.floor(self.level / 100 + 1) * 100, text_x, 370, 50, "right")
end
if sg >= 5 then
love.graphics.printf(self.SGnames[sg], 240, 450, 180, "left")
2020-11-11 21:24:56 -06:00
end
2021-07-11 22:22:16 -05:00
love.graphics.setFont(font_8x11)
love.graphics.printf(formatTime(self.frames), 64, 420, 160, "center")
2020-11-11 21:24:56 -06:00
end
return FourWideGame