From bfbba75f175df9af00be51f4d1415ba3a1986f2e Mon Sep 17 00:00:00 2001 From: --global <--global> Date: Thu, 31 Mar 2022 23:27:22 -0400 Subject: [PATCH] made the experience feel closer to arcade stackers --- load/save.lua | 2 +- main.lua | 3 +++ scene.lua | 1 + scene/arcade.lua | 52 ++++++++++++++++++++++++++++++++++++++++++ scene/game.lua | 7 +++--- scene/key_config.lua | 2 +- scene/stick_config.lua | 2 +- 7 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 scene/arcade.lua diff --git a/load/save.lua b/load/save.lua index f8e031b..cf48ba2 100644 --- a/load/save.lua +++ b/load/save.lua @@ -39,7 +39,7 @@ function initConfig() else if config.current_mode then current_mode = config.current_mode end if config.current_ruleset then current_ruleset = config.current_ruleset end - scene = TitleScene() + scene = ArcadeScene() end end diff --git a/main.lua b/main.lua index 9c04823..fef3a75 100644 --- a/main.lua +++ b/main.lua @@ -103,6 +103,9 @@ function love.keypressed(key, scancode) scene = InputConfigScene() switchBGM(nil) loadSave() + elseif scancode == "f8" and scene.title == "Arcade" then + scene = TitleScene() + playSE("mode_decide") -- secret sound playing :eyes: elseif scancode == "f8" and scene.title == "Title" then config.secret = not config.secret diff --git a/scene.lua b/scene.lua index cc5a2f6..62666a5 100644 --- a/scene.lua +++ b/scene.lua @@ -8,6 +8,7 @@ function Scene:render() end function Scene:onInputPress() end function Scene:onInputRelease() end +ArcadeScene = require "scene.arcade" ExitScene = require "scene.exit" GameScene = require "scene.game" ReplayScene = require "scene.replay" diff --git a/scene/arcade.lua b/scene/arcade.lua new file mode 100644 index 0000000..134a4cb --- /dev/null +++ b/scene/arcade.lua @@ -0,0 +1,52 @@ +local ArcadeScene = Scene:extend() + +ArcadeScene.title = "Arcade" + +function ArcadeScene:new() + self.frames = 0 + DiscordRPC:update({ + details = "In menus", + state = "Waiting for a credit", + largeImageKey = "icon2", + largeImageText = version + }) +end + +local block_offsets = { + {color = "M", x = 0, y = 0}, + {color = "G", x = 32, y = 0}, + {color = "Y", x = 64, y = 0}, + {color = "B", x = 0, y = 32}, + {color = "O", x = 0, y = 64}, + {color = "C", x = 32, y = 64}, + {color = "R", x = 64, y = 64} +} + +function ArcadeScene:update() + self.frames = self.frames + 1 +end + +function ArcadeScene:render() + love.graphics.setFont(font_3x5_3) + love.graphics.setColor(1, 1, 1, 1) + love.graphics.draw( + backgrounds["title_no_icon"], + 0, 0, 0, + 0.5, 0.5 + ) + + for _, b in ipairs(block_offsets) do + love.graphics.draw( + blocks["2tie"][b.color], + 272 + b.x, 144 + b.y, 0, + 2, 2 + ) + end + + love.graphics.printf("CAMBRIDGE: THE OPEN SOURCE ARCADE STACKER", 0, 256, 640, "center") + love.graphics.setFont(font_3x5_2) + love.graphics.setColor(1, 1, 1, 1 - (math.floor(self.frames / 60) % 2)) + love.graphics.printf("Insert 1 credit(s)", 0, 416, 640, "center") +end + +return ArcadeScene \ No newline at end of file diff --git a/scene/game.lua b/scene/game.lua index e3015ea..7e5f3eb 100644 --- a/scene/game.lua +++ b/scene/game.lua @@ -64,18 +64,19 @@ function GameScene:onInputPress(e) highscore_hash = self.game.hash .. "-" .. self.ruleset.hash submitHighscore(highscore_hash, highscore_entry) self.game:onExit() - scene = e.input == "retry" and GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs) or ModeSelectScene() + scene = ArcadeScene() + -- e.input == "retry" and GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs) or ModeSelectScene() elseif e.input == "retry" then switchBGM(nil) self.game:onExit() - scene = GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs) + scene = ArcadeScene() --GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs) elseif e.input == "pause" and not (self.game.game_over or self.game.completed) then self.paused = not self.paused if self.paused then pauseBGM() else resumeBGM() end elseif e.input == "menu_back" then self.game:onExit() - scene = ModeSelectScene() + scene = ArcadeScene() -- ModeSelectScene() elseif e.input and string.sub(e.input, 1, 5) ~= "menu_" then self.inputs[e.input] = true end diff --git a/scene/key_config.lua b/scene/key_config.lua index 419ebb5..e679e0c 100644 --- a/scene/key_config.lua +++ b/scene/key_config.lua @@ -78,7 +78,7 @@ function KeyConfigScene:onInputPress(e) if not config.input then config.input = {} end config.input.keys = self.new_input saveConfig() - scene = had_config and InputConfigScene() or TitleScene() + scene = had_config and InputConfigScene() or ArcadeScene() elseif e.scancode == "delete" or e.scancode == "backspace" then -- retry self.input_state = 1 diff --git a/scene/stick_config.lua b/scene/stick_config.lua index 3e7be01..12cb783 100644 --- a/scene/stick_config.lua +++ b/scene/stick_config.lua @@ -86,7 +86,7 @@ function StickConfigScene:onInputPress(e) if not config.input then config.input = {} end config.input.joysticks = self.new_input saveConfig() - scene = had_config and InputConfigScene() or TitleScene() + scene = had_config and InputConfigScene() or ArcadeScene() elseif e.scancode == "delete" or e.scancode == "backspace" then -- retry self.input_state = 1