From 508b044669b49e81e2a66e74f8e54dd81ef56d2c Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 20 Aug 2020 10:34:39 +0200 Subject: [PATCH] fix: lock inputs between scenes --- sonic-radiance.love/core/modules/scenes.lua | 4 ++-- sonic-radiance.love/core/scenemanager.lua | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sonic-radiance.love/core/modules/scenes.lua b/sonic-radiance.love/core/modules/scenes.lua index e0597e0..d418541 100644 --- a/sonic-radiance.love/core/modules/scenes.lua +++ b/sonic-radiance.love/core/modules/scenes.lua @@ -40,8 +40,8 @@ function Scene:new() self.menusystem = MenuSystem(self) self.sources = core.input:getSources() - self.inputLocked = false - self.inputLockedTimer = 0 + self.inputLocked = true + self.inputLockedTimer = 2 self:initWorld() diff --git a/sonic-radiance.love/core/scenemanager.lua b/sonic-radiance.love/core/scenemanager.lua index b1a8af6..56143b9 100644 --- a/sonic-radiance.love/core/scenemanager.lua +++ b/sonic-radiance.love/core/scenemanager.lua @@ -31,12 +31,14 @@ local SceneManager = Object:extend() function SceneManager:new(controller) self.controller = controller self.currentScene = nil + self.nextScene = nil self.storage = {} end function SceneManager:setScene(scene) - self.currentScene = scene + --self.currentScene = nil + self.nextScene = scene end function SceneManager:storeCurrentScene(name) @@ -63,6 +65,11 @@ end -- Update the current scene and its subobjects function SceneManager:update(dt) + if (self.nextScene ~= nil) then + self.currentScene = self.nextScene + self.nextScene = nil + end + if (self.currentScene ~= nil) then self.currentScene:updateStart(dt) self.currentScene:setKeys()