mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 07:19:02 -06:00
Added extra buttons:
- Implemented retry button* - Escape on mode select sends you to title screen - Escape on title screen closes the game - Added "Exit Game" entry on title screen, closes the game when selected *Pardon my angry comment in `scene/game.lua`.
This commit is contained in:
parent
a4984fd687
commit
5606251ea7
@ -7,6 +7,7 @@ function Scene:update() end
|
||||
function Scene:render() end
|
||||
function Scene:onKeyPress() end
|
||||
|
||||
ExitScene = require "scene.exit"
|
||||
GameScene = require "scene.game"
|
||||
ModeSelectScene = require "scene.mode_select"
|
||||
InputConfigScene = require "scene.input_config"
|
||||
|
23
scene/exit.lua
Normal file
23
scene/exit.lua
Normal file
@ -0,0 +1,23 @@
|
||||
local ExitScene = Scene:extend()
|
||||
require 'load.save'
|
||||
|
||||
ExitScene.title = "Exit Game"
|
||||
|
||||
function ExitScene:new()
|
||||
end
|
||||
|
||||
function ExitScene:update()
|
||||
love.event.quit()
|
||||
end
|
||||
|
||||
function ExitScene:render()
|
||||
end
|
||||
|
||||
function ExitScene:changeOption(rel)
|
||||
end
|
||||
|
||||
function ExitScene:onKeyPress(e)
|
||||
end
|
||||
|
||||
return ExitScene
|
||||
|
@ -57,11 +57,21 @@ end
|
||||
|
||||
function GameScene:onKeyPress(e)
|
||||
if (self.game.completed) and
|
||||
e.scancode == "return" and e.isRepeat == false then
|
||||
(e.scancode == "return" or e.scancode == "escape") and e.isRepeat == false then
|
||||
highscore_entry = self.game:getHighscoreData()
|
||||
highscore_hash = self.game.hash .. "-" .. self.ruleset.hash
|
||||
submitHighscore(highscore_hash, highscore_entry)
|
||||
scene = ModeSelectScene()
|
||||
elseif (e.scancode == config.input.retry) then
|
||||
-- fuck this, this is hacky but the way this codebase is setup prevents anything else
|
||||
-- it seems like all the values that get touched in the child gamemode class
|
||||
-- stop being linked to the values of the GameMode superclass because of how `mt.__index` works
|
||||
-- not even sure this is the actual problem, but I don't want to have to rebuild everything about
|
||||
-- the core organisation of everything. this hacky way will have to do until someone figures out something.
|
||||
love.keypressed("escape", "escape", false)
|
||||
love.keypressed("return", "return", false)
|
||||
elseif e.scancode == "escape" then
|
||||
scene = ModeSelectScene()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -15,6 +15,7 @@ local configurable_inputs = {
|
||||
"rotate_right2",
|
||||
"rotate_180",
|
||||
"hold",
|
||||
"retry",
|
||||
}
|
||||
|
||||
function ConfigScene:new()
|
||||
|
@ -100,6 +100,8 @@ function ModeSelectScene:onKeyPress(e)
|
||||
elseif (e.scancode == config.input["left"] or e.scancode == "left") or
|
||||
(e.scancode == config.input["right"] or e.scancode == "right") then
|
||||
self:switchSelect()
|
||||
elseif e.scancode == "escape" then
|
||||
scene = TitleScene()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ local TitleScene = Scene:extend()
|
||||
local main_menu_screens = {
|
||||
ModeSelectScene,
|
||||
InputConfigScene,
|
||||
ExitScene,
|
||||
}
|
||||
|
||||
function TitleScene:new()
|
||||
@ -43,6 +44,8 @@ function TitleScene:onKeyPress(e)
|
||||
self:changeOption(-1)
|
||||
elseif (e.scancode == config.input["down"] or e.scancode == "down") and e.isRepeat == false then
|
||||
self:changeOption(1)
|
||||
elseif e.scancode == "escape" and e.isRepeat == false then
|
||||
love.event.quit()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -15,7 +15,7 @@ MarathonA2Game.tagline = "The points don't matter! Can you reach the invisible r
|
||||
|
||||
|
||||
function MarathonA2Game:new()
|
||||
MarathonA2Game.super:new()
|
||||
self.super:new()
|
||||
self.big_mode = true
|
||||
self.roll_frames = 0
|
||||
self.combo = 1
|
||||
|
@ -68,6 +68,7 @@ end
|
||||
|
||||
function GameMode:initialize(ruleset)
|
||||
-- generate next queue
|
||||
self:new()
|
||||
for i = 1, self.next_queue_length do
|
||||
table.insert(self.next_queue, self:getNextPiece(ruleset))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user