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
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
function Player:wrapActor()

View file

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

View file

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