4w optimization and green/orange line adding for applicable modes

This commit is contained in:
Ishaan Bhardwaj 2020-11-02 13:46:16 -05:00
parent 6beb313c6b
commit c6482c423e
3 changed files with 23 additions and 8 deletions

View File

@ -159,6 +159,17 @@ function Grid:garbageRise(row_vals)
end end
end end
function Grid:applyFourWide()
for row = 1, 24 do
local x = self.grid[row]
x[1] = x[1]~=block and block or x[1]
x[2] = x[2]~=block and block or x[2]
x[3] = x[3]~=block and block or x[3]
x[8] = x[8]~=block and block or x[8]
x[9] = x[9]~=block and block or x[9]
x[10] = x[10]~=block and block or x[10]
end
end
function Grid:applyPiece(piece) function Grid:applyPiece(piece)
if piece.big then if piece.big then
self:applyBigPiece(piece) self:applyBigPiece(piece)
@ -249,7 +260,7 @@ function Grid:update()
end end
function Grid:draw() function Grid:draw()
for y = 1, 24 do for y = 5, 24 do
for x = 1, 10 do for x = 1, 10 do
if self.grid[y][x] ~= empty then if self.grid[y][x] ~= empty then
if self.grid_age[y][x] < 1 then if self.grid_age[y][x] < 1 then
@ -281,7 +292,7 @@ function Grid:draw()
end end
function Grid:drawInvisible(opacity_function, garbage_opacity_function) function Grid:drawInvisible(opacity_function, garbage_opacity_function)
for y = 1, 24 do for y = 5, 24 do
for x = 1, 10 do for x = 1, 10 do
if self.grid[y][x] ~= empty then if self.grid[y][x] ~= empty then
if self.grid[y][x].colour == "X" then if self.grid[y][x].colour == "X" then

View File

@ -100,7 +100,7 @@ end
function MarathonA2Game:advanceOneFrame() function MarathonA2Game:advanceOneFrame()
if self.clear then if self.clear then
self.roll_frames = self.roll_frames + 1 self.roll_frames = self.roll_frames + 1
if self.roll_frames < 0 then return true end if self.roll_frames < 0 then return false end
if self.roll_frames > 3694 then if self.roll_frames > 3694 then
self.completed = true self.completed = true
end end
@ -122,7 +122,7 @@ function MarathonA2Game:onLineClear(cleared_row_count)
if self.level == 999 and not self.clear then if self.level == 999 and not self.clear then
self.clear = true self.clear = true
self.grid:clear() self.grid:clear()
self.roll_frames = -1500 self.roll_frames = -150
end end
end end
@ -204,7 +204,7 @@ local grade_conversion = {
1, 2, 3, 4, 5, 5, 6, 6, 7, 7, 1, 2, 3, 4, 5, 5, 6, 6, 7, 7,
7, 8, 8, 8, 9, 9, 9, 10, 11, 12, 7, 8, 8, 8, 9, 9, 9, 10, 11, 12,
12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16,
17, 18, 19 17, 18
} }
function MarathonA2Game:updateGrade(cleared_lines) function MarathonA2Game:updateGrade(cleared_lines)
@ -270,7 +270,10 @@ function MarathonA2Game:drawScoringInfo()
love.graphics.printf("LEVEL", 240, 320, 40, "left") love.graphics.printf("LEVEL", 240, 320, 40, "left")
love.graphics.setFont(font_3x5_3) love.graphics.setFont(font_3x5_3)
if self.roll_frames > 3694 then love.graphics.setColor(1, 0.5, 0, 1)
elseif self.clear then love.graphics.setColor(0, 1, 0, 1) end
love.graphics.printf(self:getLetterGrade(), 240, 140, 90, "left") love.graphics.printf(self:getLetterGrade(), 240, 140, 90, "left")
love.graphics.setColor(1, 1, 1, 1)
love.graphics.printf(self.score, 240, 220, 90, "left") love.graphics.printf(self.score, 240, 220, 90, "left")
love.graphics.printf(self.level, 240, 340, 40, "right") love.graphics.printf(self.level, 240, 340, 40, "right")
love.graphics.printf(self:getSectionEndLevel(), 240, 370, 40, "right") love.graphics.printf(self:getSectionEndLevel(), 240, 370, 40, "right")

View File

@ -16,7 +16,6 @@ SurvivalA3Game.tagline = "The blocks turn black and white! Can you make it to le
function SurvivalA3Game:new() function SurvivalA3Game:new()
SurvivalA3Game.super:new() SurvivalA3Game.super:new()
self.level = 0
self.grade = 0 self.grade = 0
self.garbage = 0 self.garbage = 0
self.clear = false self.clear = false
@ -140,7 +139,6 @@ function SurvivalA3Game:onPieceEnter()
end end
local cleared_row_levels = {1, 2, 4, 6} local cleared_row_levels = {1, 2, 4, 6}
local cleared_row_points = {0.02, 0.05, 0.15, 0.6}
function SurvivalA3Game:onLineClear(cleared_row_count) function SurvivalA3Game:onLineClear(cleared_row_count)
if not self.clear then if not self.clear then
@ -243,7 +241,10 @@ function SurvivalA3Game:drawScoringInfo()
self:drawSectionTimesWithSplits(current_section) self:drawSectionTimesWithSplits(current_section)
love.graphics.setFont(font_3x5_3) love.graphics.setFont(font_3x5_3)
if self.roll_frames > 3238 then love.graphics.setColor(1, 0.5, 0, 1)
elseif self.clear then love.graphics.setColor(0, 1, 0, 1) end
love.graphics.printf(getLetterGrade(math.floor(self.grade)), text_x, 140, 90, "left") 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.score, text_x, 220, 90, "left")
love.graphics.printf(self.level, text_x, 340, 50, "right") love.graphics.printf(self.level, text_x, 340, 50, "right")
if self.clear then if self.clear then