C88 cleanup

pull/4/head
Ishaan Bhardwaj 2021-01-11 20:48:09 -05:00
parent d6707cbf48
commit ac7fad1003
1 changed files with 18 additions and 11 deletions

View File

@ -38,23 +38,14 @@ function MarathonC88Game:new(secret_inputs)
self.irs = false
self.grid.getCell = function(_, x, y)
if x < 1 or x > 10 or y < 5 or y > 24 then return oob
self.grid.getCell = function(self, x, y)
if x < 1 or x > self.width or y < 5 or y > self.height then return oob
elseif y < 1 then return empty
else return self.grid[y][x]
end
end
end
function MarathonC88Game:initialize(ruleset)
self.super:initialize(ruleset)
for _, p in pairs(ruleset.spawn_positions) do
while p.y < 4 do
p.y = p.y + 2
end
end
end
function MarathonC88Game:getARE() return 30 end
function MarathonC88Game:getLineARE() return 30 end
function MarathonC88Game:getDasLimit() return 20 end
@ -98,6 +89,22 @@ function MarathonC88Game:getScoreMultiplier()
else return 5 end
end
function MarathonC88Game:onPieceEnter()
function checkOOB()
local offsets = self.piece:getBlockOffsets()
for _, offset in pairs(offsets) do
if self.piece.position.y + offset.y < 4 then
return true
end
end
return false
end
while checkOOB() do
self.piece.position.y = self.piece.position.y + 1
end
end
function MarathonC88Game:advanceOneFrame()
if not (self.piece == nil and self.level_timer == 0) and self.ready_frames == 0 then
self.level_timer = self.level_timer + 1