scenes/boost: lock input just after the menu closure
This commit is contained in:
parent
7065028143
commit
0e43ef3e4d
3 changed files with 17 additions and 3 deletions
|
@ -100,8 +100,13 @@ function Player:new(manager, playerid, character, rail)
|
|||
end
|
||||
|
||||
function Player:getKeys()
|
||||
if self.controller.areInputsLocked then
|
||||
self.controller.areInputsLocked = false
|
||||
return core.input.fakekeys
|
||||
else
|
||||
return self.controller.keys
|
||||
end
|
||||
end
|
||||
|
||||
function Player:wrapActor()
|
||||
self.actor.view.x = math.floor(self.actor.view.x - self.controller.world.width)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue