diff --git a/tetris/modes/inversion_a2n.lua b/tetris/modes/inversion_a2n.lua new file mode 100644 index 0000000..4824f19 --- /dev/null +++ b/tetris/modes/inversion_a2n.lua @@ -0,0 +1,39 @@ +local SurvivalA2Game = require "tetris.modes.survival_a2n" + +local InversionGame = SurvivalA2Game:extend() + +InversionGame.name = "Inversion A2N" +InversionGame.hash = "InversionA2N" +InversionGame.tagline = "What if the active piece was invisible?" + +function InversionGame:new() + SurvivalA2Game:new() + self.piece_active_time = 0 +end + +function InversionGame:onPieceEnter() + if (self.level % 100 ~= 99 and self.level ~= 998) and not self.clear and self.frames ~= 0 then + self.level = self.level + 1 + end + self.piece_active_time = 0 +end + +function InversionGame:onHold() + self.piece_active_time = 0 +end + +function InversionGame:whilePieceActive() + self.piece_active_time = self.piece_active_time + 1 +end + +function InversionGame:getPieceFadeoutTime() + return math.ceil(self:getLockDelay() / 4) +end + +function InversionGame:drawPiece() + if self.piece ~= nil then + self.piece:draw(1 - self.piece_active_time / self:getPieceFadeoutTime(), 1, grid) + end +end + +return InversionGame \ No newline at end of file diff --git a/tetris/rulesets/randompieces.lua b/tetris/rulesets/randompieces.lua index 9ae4606..c81601e 100644 --- a/tetris/rulesets/randompieces.lua +++ b/tetris/rulesets/randompieces.lua @@ -41,10 +41,6 @@ RandomPieces.big_spawn_positions = { { x=2, y=3 } } -RandomPieces.draw_offsets = { - { x=0, y=0 } -} - RandomPieces.next_sounds = { "O" } diff --git a/tetris/rulesets/tetra.lua b/tetris/rulesets/tetra.lua index eeaef5c..fdd75cc 100644 --- a/tetris/rulesets/tetra.lua +++ b/tetris/rulesets/tetra.lua @@ -100,6 +100,7 @@ function Tetra:onPieceCreate(piece) piece.lowest_y = -math.huge end function Tetra:onPieceDrop(piece) self:checkNewLow(piece) end function Tetra:onPieceMove() end function Tetra:onPieceRotate() end +function Tetra:canPieceRotate() return true end function Tetra:get180RotationValue() return 2 end return Tetra