Added drop bonuses and fixed some of the delays.

pull/1/head
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
end
local piece_y = self.piece.position.y
ruleset:processPiece(
inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs,
self.move, self:getLockDelay(), self:getDropSpeed(),
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
self.piece:isDropBlocked(self.grid) and
not self.hard_drop_locked and
self.instant_hard_drop
then
self.piece.locked = true
not self.hard_drop_locked then
self:onHardDrop(piece_dy)
if self.instant_hard_drop then
self.piece.locked = true
end
end
if inputs["down"] == true and
self.piece:isDropBlocked(self.grid) and
not self.drop_locked and
self.instant_soft_drop
then
self.piece.locked = true
if inputs["down"] == true then
self:onSoftDrop(piece_dy)
if self.piece:isDropBlocked(self.grid) and
not self.drop_locked and
self.instant_soft_drop
then
self.piece.locked = true
end
end
if self.piece.locked == true then
@ -189,6 +196,14 @@ function GameMode:onLineClear(cleared_row_count) end
function GameMode:onPieceEnter() 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()
switchBGM(nil)
end
@ -374,7 +389,8 @@ function GameMode:drawScoringInfo()
love.graphics.print(
self.das.direction .. " " ..
self.das.frames .. " " ..
st(self.prev_inputs)
st(self.prev_inputs) ..
self.drop_bonus
)
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.arr = 1
MarathonA1Game.drop_speed = 1
function MarathonA1Game:getDropSpeed() return 0.2 end
function MarathonA1Game:new()
MarathonA1Game.super:new()
@ -34,11 +34,11 @@ function MarathonA1Game:new()
end
function MarathonA1Game:getARE()
return 25
return 30
end
function MarathonA1Game:getLineARE()
return 25
return 27
end
function MarathonA1Game:getDasLimit()
@ -46,7 +46,7 @@ function MarathonA1Game:getDasLimit()
end
function MarathonA1Game:getLineClearDelay()
return 40
return 44
end
function MarathonA1Game:getLockDelay()

View File

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

View File

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