mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 13:29:03 -06:00
Almost done with Sakura
This commit is contained in:
parent
1a68cd8fce
commit
57bd6a8286
@ -288,6 +288,7 @@ function Grid:mirror()
|
|||||||
local new_grid = {}
|
local new_grid = {}
|
||||||
for y = 1, 24 do
|
for y = 1, 24 do
|
||||||
for x = 1, 10 do
|
for x = 1, 10 do
|
||||||
|
print(#self.grid)
|
||||||
new_grid[y][x] = self.grid[y][11 - x]
|
new_grid[y][x] = self.grid[y][11 - x]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,7 +3,7 @@ require 'funcs'
|
|||||||
local GameMode = require 'tetris.modes.gamemode'
|
local GameMode = require 'tetris.modes.gamemode'
|
||||||
local Piece = require 'tetris.components.piece'
|
local Piece = require 'tetris.components.piece'
|
||||||
|
|
||||||
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls_35bag'
|
local SakuraRandomizer = require 'tetris.randomizers.sakura'
|
||||||
|
|
||||||
local SakuraGame = GameMode:extend()
|
local SakuraGame = GameMode:extend()
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ local STAGE_TRANSITION_TIME = 300
|
|||||||
function SakuraGame:new()
|
function SakuraGame:new()
|
||||||
self.super:new()
|
self.super:new()
|
||||||
|
|
||||||
self.randomizer = History6RollsRandomizer()
|
self.randomizer = SakuraRandomizer()
|
||||||
|
|
||||||
self.current_map = 1
|
self.current_map = 1
|
||||||
self.time_limit = 10800
|
self.time_limit = 10800
|
||||||
@ -313,6 +313,12 @@ function SakuraGame:onPieceEnter()
|
|||||||
self.stage_pieces = self.stage_pieces + 1
|
self.stage_pieces = self.stage_pieces + 1
|
||||||
end
|
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)
|
function SakuraGame:advanceOneFrame(inputs, ruleset)
|
||||||
if self.ready_frames == 0 then
|
if self.ready_frames == 0 then
|
||||||
if self.lcd > 0 then
|
if self.lcd > 0 then
|
||||||
|
16
tetris/randomizers/fixed_sequence.lua
Normal file
16
tetris/randomizers/fixed_sequence.lua
Normal 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
|
10
tetris/randomizers/sakura.lua
Normal file
10
tetris/randomizers/sakura.lua
Normal 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
|
Loading…
Reference in New Issue
Block a user