Almost done with Sakura

pull/13/head
Ishaan Bhardwaj 2021-01-03 23:18:57 -05:00
parent 1a68cd8fce
commit 57bd6a8286
4 changed files with 35 additions and 2 deletions

View File

@ -288,6 +288,7 @@ function Grid:mirror()
local new_grid = {}
for y = 1, 24 do
for x = 1, 10 do
print(#self.grid)
new_grid[y][x] = self.grid[y][11 - x]
end
end

View File

@ -3,7 +3,7 @@ require 'funcs'
local GameMode = require 'tetris.modes.gamemode'
local Piece = require 'tetris.components.piece'
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls_35bag'
local SakuraRandomizer = require 'tetris.randomizers.sakura'
local SakuraGame = GameMode:extend()
@ -267,7 +267,7 @@ local STAGE_TRANSITION_TIME = 300
function SakuraGame:new()
self.super:new()
self.randomizer = History6RollsRandomizer()
self.randomizer = SakuraRandomizer()
self.current_map = 1
self.time_limit = 10800
@ -313,6 +313,12 @@ function SakuraGame:onPieceEnter()
self.stage_pieces = self.stage_pieces + 1
end
function SakuraGame:onPieceLock()
if effects[self.current_map] == "mirror" and self.stage_pieces % 3 == 0 then
self.grid:mirror()
end
end
function SakuraGame:advanceOneFrame(inputs, ruleset)
if self.ready_frames == 0 then
if self.lcd > 0 then

View File

@ -0,0 +1,16 @@
local Randomizer = require 'tetris.randomizers.randomizer'
local Sequence = Randomizer:extend()
function Sequence:initialize()
self.sequence = "IJLOT"
self.counter = 0
end
function Sequence:generatePiece()
local piece = string.sub(self.sequence, self.counter + 1, self.counter + 1)
self.counter = (self.counter + 1) % string.len(self.sequence)
return piece
end
return Sequence

View File

@ -0,0 +1,10 @@
local Sequence = require 'tetris.randomizers.fixed_sequence'
local Sakura = Sequence:extend()
function Sakura:initialize()
self.super:initialize()
self.sequence = "LIJOTSZILJOTISJZLOIJSZTIOJZTLSOZTISOLTJSIZTOJLIZSTOIZLTJOSILTZSOITJLZSTJJISOLJITSLZOIZSJOITSZLJTSZLISTJLZOTIOZSJILTZSOITZJSOLTJSZIOJLZIOJTZIZLOSIZTJOILZSOJIOSZTJILOSSILZOTJIZTSOLZTSOIJTZSILTZOSIJZTOLJISOLJTZSOLTZJSOTILZJTOLZIJSOZTJLOZSTLOZITSOLZTJIOSLZJTO"
end
return Sakura