Can send inputs from mode select to game

Warning: this may break some things
This commit is contained in:
Ishaan Bhardwaj
2021-01-05 21:59:50 -05:00
parent 45120bc9f7
commit 0d13a9f236
4 changed files with 36 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ local GameMode = Object:extend()
GameMode.rollOpacityFunction = function(age) return 0 end
function GameMode:new()
function GameMode:new(secret_inputs)
self.grid = Grid()
self.randomizer = Randomizer()
self.piece = nil
@@ -80,9 +80,9 @@ function GameMode:getNextPiece(ruleset)
}
end
function GameMode:initialize(ruleset)
function GameMode:initialize(ruleset, secret_inputs)
-- generate next queue
self:new()
self:new(secret_inputs)
for i = 1, self.next_queue_length do
table.insert(self.next_queue, self:getNextPiece(ruleset))
end

View File

@@ -4,6 +4,7 @@ local GameMode = require 'tetris.modes.gamemode'
local Piece = require 'tetris.components.piece'
local SakuraRandomizer = require 'tetris.randomizers.sakura'
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls_35bag'
local SakuraGame = GameMode:extend()
@@ -264,10 +265,14 @@ local maps = {
local STAGE_TRANSITION_TIME = 300
function SakuraGame:new()
function SakuraGame:new(secret_inputs)
self.super:new()
self.randomizer = SakuraRandomizer()
self.randomizer = (
(
secret_inputs.rotate_left and secret_inputs.rotate_right
) and History6RollsRandomizer() or SakuraRandomizer()
)
self.current_map = 1
self.time_limit = 10800
@@ -482,6 +487,9 @@ function SakuraGame:drawScoringInfo()
if effects[self.current_map] then
love.graphics.printf("EFFECT: " .. effects[self.current_map], 240, 300, 160, "left")
end
if self.randomizer.history then
love.graphics.printf("RANDOM PIECES ACTIVE!", 240, 295, 200, "left")
end
love.graphics.setFont(font_3x5_3)
love.graphics.setColor(