Added drop bonuses and fixed some of the delays.

This commit is contained in:
Joe Z 2019-05-29 00:52:54 -04:00
parent b316d9617b
commit 1d6ac62d7d
4 changed files with 51 additions and 35 deletions

View File

@ -114,26 +114,33 @@ function GameMode:update(inputs, ruleset)
self.hard_drop_locked = false self.hard_drop_locked = false
end end
local piece_y = self.piece.position.y
ruleset:processPiece( ruleset:processPiece(
inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs, inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs,
self.move, self:getLockDelay(), self:getDropSpeed(), self.move, self:getLockDelay(), self:getDropSpeed(),
self.drop_locked, self.hard_drop_locked, self.enable_hard_drop self.drop_locked, self.hard_drop_locked, self.enable_hard_drop
) )
local piece_dy = self.piece.position.y - piece_y
if inputs["up"] == true and if inputs["up"] == true and
self.piece:isDropBlocked(self.grid) and self.piece:isDropBlocked(self.grid) and
not self.hard_drop_locked and not self.hard_drop_locked then
self.instant_hard_drop self:onHardDrop(piece_dy)
then if self.instant_hard_drop then
self.piece.locked = true self.piece.locked = true
end
end end
if inputs["down"] == true and if inputs["down"] == true then
self.piece:isDropBlocked(self.grid) and self:onSoftDrop(piece_dy)
not self.drop_locked and if self.piece:isDropBlocked(self.grid) and
self.instant_soft_drop not self.drop_locked and
then self.instant_soft_drop
self.piece.locked = true then
self.piece.locked = true
end
end end
if self.piece.locked == true then if self.piece.locked == true then
@ -189,6 +196,14 @@ function GameMode:onLineClear(cleared_row_count) end
function GameMode:onPieceEnter() end function GameMode:onPieceEnter() end
function GameMode:onHold() end function GameMode:onHold() end
function GameMode:onSoftDrop(dropped_row_count)
self.drop_bonus = self.drop_bonus + 1 * dropped_row_count
end
function GameMode:onHardDrop(dropped_row_count)
self.drop_bonus = self.drop_bonus + 2 * dropped_row_count
end
function GameMode:onGameOver() function GameMode:onGameOver()
switchBGM(nil) switchBGM(nil)
end end
@ -374,7 +389,8 @@ function GameMode:drawScoringInfo()
love.graphics.print( love.graphics.print(
self.das.direction .. " " .. self.das.direction .. " " ..
self.das.frames .. " " .. self.das.frames .. " " ..
st(self.prev_inputs) st(self.prev_inputs) ..
self.drop_bonus
) )
love.graphics.setFont(font_8x11) love.graphics.setFont(font_8x11)

View File

@ -12,7 +12,7 @@ MarathonA1Game.hash = "MarathonA1"
MarathonA1Game.tagline = "Can you score enough points to reach the title of Grand Master?" MarathonA1Game.tagline = "Can you score enough points to reach the title of Grand Master?"
MarathonA1Game.arr = 1 MarathonA1Game.arr = 1
MarathonA1Game.drop_speed = 1 function MarathonA1Game:getDropSpeed() return 0.2 end
function MarathonA1Game:new() function MarathonA1Game:new()
MarathonA1Game.super:new() MarathonA1Game.super:new()
@ -34,11 +34,11 @@ function MarathonA1Game:new()
end end
function MarathonA1Game:getARE() function MarathonA1Game:getARE()
return 25 return 30
end end
function MarathonA1Game:getLineARE() function MarathonA1Game:getLineARE()
return 25 return 27
end end
function MarathonA1Game:getDasLimit() function MarathonA1Game:getDasLimit()
@ -46,7 +46,7 @@ function MarathonA1Game:getDasLimit()
end end
function MarathonA1Game:getLineClearDelay() function MarathonA1Game:getLineClearDelay()
return 40 return 44
end end
function MarathonA1Game:getLockDelay() function MarathonA1Game:getLockDelay()

View File

@ -35,16 +35,16 @@ function MarathonA2Game:new()
end end
function MarathonA2Game:getARE() function MarathonA2Game:getARE()
if self.level < 700 then return 25 if self.level < 700 then return 28
elseif self.level < 800 then return 16 elseif self.level < 800 then return 19
else return 12 end else return 15 end
end end
function MarathonA2Game:getLineARE() function MarathonA2Game:getLineARE()
if self.level < 600 then return 25 if self.level < 600 then return 27
elseif self.level < 700 then return 16 elseif self.level < 700 then return 18
elseif self.level < 800 then return 12 elseif self.level < 800 then return 14
else return 6 end else return 8 end
end end
function MarathonA2Game:getDasLimit() function MarathonA2Game:getDasLimit()
@ -54,11 +54,11 @@ function MarathonA2Game:getDasLimit()
end end
function MarathonA2Game:getLineClearDelay() function MarathonA2Game:getLineClearDelay()
if self.level < 500 then return 40 if self.level < 500 then return 41
elseif self.level < 600 then return 25 elseif self.level < 600 then return 26
elseif self.level < 700 then return 16 elseif self.level < 700 then return 17
elseif self.level < 800 then return 12 elseif self.level < 800 then return 13
else return 6 end else return 7 end
end end
function MarathonA2Game:getLockDelay() function MarathonA2Game:getLockDelay()

View File

@ -33,23 +33,23 @@ function SurvivalA1Game:new()
self.next_queue_length = 1 self.next_queue_length = 1
end end
function SurvivalA1Game:getARE() function MarathonA1Game:getARE()
return 25 return 30
end end
function SurvivalA1Game:getLineARE() function MarathonA1Game:getLineARE()
return 25 return 27
end end
function SurvivalA1Game:getDasLimit() function MarathonA1Game:getDasLimit()
return 15 return 15
end end
function SurvivalA1Game:getLineClearDelay() function MarathonA1Game:getLineClearDelay()
return 40 return 44
end end
function SurvivalA1Game:getLockDelay() function MarathonA1Game:getLockDelay()
return 30 return 30
end end