afterLineClear func added and splits time draw fix

pull/16/head v0.3-beta3
Ishaan Bhardwaj 2021-02-15 12:26:52 -05:00
parent cdd846c3e6
commit 9ac60cbb5e
2 changed files with 14 additions and 4 deletions

View File

@ -394,7 +394,8 @@ end
function Grid:draw()
for y = 5, self.height do
for x = 1, self.width do
if self.grid[y][x] ~= empty then
if blocks[self.grid[y][x].skin] and
blocks[self.grid[y][x].skin][self.grid[y][x].colour] then
if self.grid_age[y][x] < 2 then
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(blocks[self.grid[y][x].skin]["F"], 48+x*16, y*16)

View File

@ -264,6 +264,7 @@ function GameMode:update(inputs, ruleset)
)
if self.lcd == 0 then
self.grid:clearClearedRows()
self:afterLineClear(cleared_row_count)
if self.are == 0 then
self:initializeOrHold(inputs, ruleset)
end
@ -300,6 +301,7 @@ function GameMode:onPieceLock(piece, cleared_row_count)
end
function GameMode:onLineClear(cleared_row_count) end
function GameMode:afterLineClear(cleared_row_count) end
function GameMode:onPieceEnter() end
function GameMode:onHold() end
@ -431,7 +433,9 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
self.lcd = self.lcd - 1
self:areCancel(inputs, ruleset)
if self.lcd == 0 then
local cleared_row_count = self.grid:getClearedRowCount()
self.grid:clearClearedRows()
self:afterLineClear(cleared_row_count)
playSE("fall")
if self.are == 0 then
self:initializeOrHold(inputs, ruleset)
@ -759,7 +763,9 @@ function GameMode:drawSectionTimesWithSecondary(current_section, section_limit)
end
end
function GameMode:drawSectionTimesWithSplits(current_section)
function GameMode:drawSectionTimesWithSplits(current_section, section_limit)
section_limit = section_limit or math.huge
local section_x = 440
local split_x = 530
@ -773,8 +779,11 @@ function GameMode:drawSectionTimesWithSplits(current_section)
end
end
if (current_section <= section_limit) then
love.graphics.setColor(self:sectionColourFunction(current_section))
love.graphics.printf(formatTime(self.frames - self.section_start_time), section_x, 40 + 20 * current_section, 90, "left")
love.graphics.printf(formatTime(self.frames), split_x, 40 + 20 * current_section, 90, "left")
end
end
function GameMode:drawCustom() end