scenes/boost: lock input just after the menu closure

This commit is contained in:
Kazhnuz 2019-02-15 21:39:09 +01:00
parent 7065028143
commit 0e43ef3e4d
3 changed files with 17 additions and 3 deletions

View file

@ -100,7 +100,12 @@ function Player:new(manager, playerid, character, rail)
end end
function Player:getKeys() function Player:getKeys()
return self.controller.keys if self.controller.areInputsLocked then
self.controller.areInputsLocked = false
return core.input.fakekeys
else
return self.controller.keys
end
end end
function Player:wrapActor() function Player:wrapActor()

View file

@ -42,7 +42,7 @@ function ResumeWidget:action()
self.menu.isActive = false self.menu.isActive = false
self.menu.isVisible = false self.menu.isVisible = false
self.menu.controller.assets.isActive = true self.menu.controller.assets.isActive = true
self.menu.controller:flushKeys() self.menu.controller:lockInputs()
end end
function RestartWidget:new(menu, font) function RestartWidget:new(menu, font)
@ -50,6 +50,7 @@ function RestartWidget:new(menu, font)
end end
function RestartWidget:action() function RestartWidget:action()
self.menu.controller:lockInputs()
self.menu.controller:restartLevel() self.menu.controller:restartLevel()
end end

View file

@ -45,6 +45,10 @@ function BoostLevel:new()
--self.characters:newDummy("sonic", 3) --self.characters:newDummy("sonic", 3)
--self.characters:newDummy("sonic", 4) --self.characters:newDummy("sonic", 4)
if self.areInputsLocked == nil then
self.areInputsLocked = false
end
self:register() self:register()
end end
@ -122,6 +126,10 @@ function BoostLevel:update(dt)
end end
end end
function BoostLevel:lockInputs()
self.areInputsLocked = true
end
function BoostLevel:draw() function BoostLevel:draw()
self.background:draw() self.background:draw()
@ -142,7 +150,7 @@ function BoostLevel:restartLevel()
end end
function BoostLevel:exitLevel() function BoostLevel:exitLevel()
Gamestate.switch(Scenes.options) scenes.title()
end end
function BoostLevel:leave() function BoostLevel:leave()