Made Stacker a little more... evil. (read below)

Not rigged, just harder.
This commit is contained in:
Ishaan Bhardwaj 2021-02-06 20:53:05 -05:00
parent 484c8adff3
commit 67fdfa56b7

View File

@ -17,7 +17,7 @@ function StackerGame:new()
self.row = 19 self.row = 19
self.block_width = 3 self.block_width = 3
self.position = 0 self.position = 0
self.direction = 1 self.direction = 0
self.ticks = 0 self.ticks = 0
self.are = 30 self.are = 30
self.map = {} self.map = {}
@ -26,7 +26,7 @@ function StackerGame:new()
end end
function StackerGame:getSpeed() function StackerGame:getSpeed()
return 20 ^ ((self.row - 4) / 15) return 5--20 ^ ((self.row - 4) / 15)
end end
function StackerGame:getMaxBlockWidth() function StackerGame:getMaxBlockWidth()
@ -54,6 +54,10 @@ function StackerGame:advanceOneFrame(inputs, ruleset)
if self.are > 0 then if self.are > 0 then
self.are = self.are - 1 self.are = self.are - 1
return false return false
elseif self.are == 0 then
self.position = math.random(1, 7 + self.block_width - 1)
self.direction = ({-1, 1})[math.random(2)]
self.are = -1
end end
if not self.prev_inputs.up and inputs.up then if not self.prev_inputs.up and inputs.up then
self.prev_inputs = inputs self.prev_inputs = inputs
@ -84,6 +88,7 @@ function StackerGame:advanceOneFrame(inputs, ruleset)
self.ticks = 0 self.ticks = 0
self.block_width = new_width self.block_width = new_width
self.position = 0 self.position = 0
self.direction = 0
self.are = 30 self.are = 30
self:updateGrid() self:updateGrid()
end end
@ -109,7 +114,24 @@ local function noOutline(game, block, x, y, age)
return x, x, x, 1, 0 return x, x, x, 1, 0
end end
function StackerGame:onGameComplete() end function StackerGame:onGameComplete()
self.grid:clear()
local win = {
[6] = {nil, block, nil, nil, nil, block, nil},
[7] = {nil, block, nil, block, nil, block, nil},
[8] = {nil, block, block, nil, block, block, nil},
[9] = {nil, block, nil, nil, nil, block, nil},
[11] = {nil, nil, nil, block, nil, nil, nil},
[12] = {nil, nil, nil, block, nil, nil, nil},
[13] = {nil, nil, nil, block, nil, nil, nil},
[14] = {nil, nil, nil, block, nil, nil, nil},
[16] = {nil, block, nil, block, block, nil, nil},
[17] = {nil, block, block, nil, nil, block, nil},
[18] = {nil, block, nil, nil, nil, block, nil},
[19] = {nil, block, nil, nil, nil, block, nil},
}
self.grid:applyMap(win)
end
function StackerGame:drawGrid() function StackerGame:drawGrid()
self.grid:drawCustom(noOutline, self) self.grid:drawCustom(noOutline, self)