mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 09:19:03 -06:00
Miscellaneous fixes to piece behavior in addition to fixing prev. commit
This commit is contained in:
parent
3c718c38e4
commit
61de3c6dbf
@ -45,7 +45,9 @@ function GameScene:render()
|
||||
self.game:drawBackground()
|
||||
self.game:drawFrame()
|
||||
self.game:drawGrid()
|
||||
if self.game.lcd > 0 then self.game:drawLineClearAnimation() end
|
||||
if self.game:canDrawLCA() then
|
||||
self.game:drawLineClearAnimation()
|
||||
end
|
||||
self.game:drawPiece()
|
||||
self.game:drawNextQueue(self.ruleset)
|
||||
self.game:drawScoringInfo()
|
||||
|
@ -156,9 +156,6 @@ function GameMode:update(inputs, ruleset)
|
||||
if self.enable_hold and inputs["hold"] == true and self.held == false and self.prev_inputs["hold"] == false then
|
||||
self:hold(inputs, ruleset)
|
||||
self.prev_inputs = inputs
|
||||
if not self.grid:canPlacePiece(self.piece) then
|
||||
self.game_over = true
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
@ -498,6 +495,10 @@ function GameMode:initializeOrHold(inputs, ruleset)
|
||||
if not self.grid:canPlacePiece(self.piece) then
|
||||
self.game_over = true
|
||||
end
|
||||
ruleset:dropPiece(
|
||||
inputs, self.piece, self.grid, self:getGravity(),
|
||||
self:getDropSpeed(), self.drop_locked, self.hard_drop_locked
|
||||
)
|
||||
end
|
||||
|
||||
function GameMode:hold(inputs, ruleset, ihs)
|
||||
@ -522,17 +523,19 @@ function GameMode:hold(inputs, ruleset, ihs)
|
||||
if ihs then playSE("ihs")
|
||||
else playSE("hold") end
|
||||
self:onHold()
|
||||
if not self.grid:canPlacePiece(self.piece) then
|
||||
self.game_over = true
|
||||
end
|
||||
end
|
||||
|
||||
function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next_piece)
|
||||
self.piece_hard_dropped = false
|
||||
self.piece_soft_locked = false
|
||||
local gravity = self:getGravity()
|
||||
self.piece = ruleset:initializePiece(
|
||||
inputs, piece_data, self.grid, gravity,
|
||||
inputs, piece_data, self.grid, self:getGravity(),
|
||||
self.prev_inputs, self.move,
|
||||
self:getLockDelay(), self:getDropSpeed(),
|
||||
self.lock_drop, self.lock_hard_drop, self.big_mode,
|
||||
self.drop_locked, self.hard_drop_locked, self.big_mode,
|
||||
(
|
||||
self.frames == 0 or (ruleset.are and self:getARE() ~= 0)
|
||||
) and self.irs or false
|
||||
@ -607,6 +610,10 @@ function GameMode:animation(x, y, skin, colour)
|
||||
}
|
||||
end
|
||||
|
||||
function GameMode:canDrawLCA()
|
||||
return self.lcd > 0
|
||||
end
|
||||
|
||||
function GameMode:drawLineClearAnimation()
|
||||
-- animation function
|
||||
-- params: block x, y, skin, colour
|
||||
|
@ -221,16 +221,7 @@ function Ruleset:initializePiece(
|
||||
colours = self.colourscheme
|
||||
end
|
||||
|
||||
local spawn_x
|
||||
if (grid.width ~= 10) then
|
||||
local percent = spawn_positions[data.shape].x / 10
|
||||
for i = grid.width - 1, 0, -1 do
|
||||
if i / grid.width <= percent then
|
||||
spawn_x = i
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
local spawn_x = math.floor(spawn_positions[data.shape].x / 10 * grid.width)
|
||||
|
||||
local spawn_dy
|
||||
if (config.gamesettings.spawn_positions == 1) then
|
||||
@ -257,7 +248,6 @@ function Ruleset:initializePiece(
|
||||
playSE("irs")
|
||||
end
|
||||
end
|
||||
self:dropPiece(inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked)
|
||||
return piece
|
||||
end
|
||||
|
||||
@ -276,9 +266,9 @@ function Ruleset:processPiece(
|
||||
|
||||
if synchroes_allowed then
|
||||
self:rotatePiece(inputs, piece, grid, prev_inputs, false)
|
||||
self:movePiece(piece, grid, move, gravity >= 20)
|
||||
self:movePiece(piece, grid, move, gravity >= grid.height - 4)
|
||||
else
|
||||
self:movePiece(piece, grid, move, gravity >= 20)
|
||||
self:movePiece(piece, grid, move, gravity >= grid.height - 4)
|
||||
self:rotatePiece(inputs, piece, grid, prev_inputs, false)
|
||||
end
|
||||
self:dropPiece(
|
||||
|
Loading…
Reference in New Issue
Block a user