summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-08-15 16:24:31 +0200
committerAki <nthirtyone@gmail.com>2016-08-15 16:24:31 +0200
commit813fd73eb0bc4b74b9ea39654491ca37456408e2 (patch)
treed561e753c503ddf50ab4a222a5fba01b4726811a
parent7f188301d4e3d7e78489d7abcb874e7e98a22bf5 (diff)
downloadroflnauts-813fd73eb0bc4b74b9ea39654491ca37456408e2.zip
roflnauts-813fd73eb0bc4b74b9ea39654491ca37456408e2.tar.gz
roflnauts-813fd73eb0bc4b74b9ea39654491ca37456408e2.tar.bz2
World to menu fix; countdown jump fix
-rw-r--r--menu.lua17
-rw-r--r--world.lua6
2 files changed, 13 insertions, 10 deletions
diff --git a/menu.lua b/menu.lua
index 738a1d1..29daa90 100644
--- a/menu.lua
+++ b/menu.lua
@@ -90,14 +90,18 @@ function Menu:getSelectorsLocked()
return t
end
--- Tests if Control set is assigned to any selector
+-- Tests if Control set is assigned to any selector (1.) and if it is locked (2.)
function Menu:isSetUsed(set)
for k,selector in pairs(self:getSelectorsActive()) do
if selector:getControlSet() == set then
- return true
+ if selector:getState() == 2 then
+ return true, true
+ else
+ return true, false
+ end
end
end
- return false
+ return false, false
end
-- Header get bounce move
@@ -175,11 +179,12 @@ end
-- Controller callbacks
function Menu:controlpressed(set, action, key)
+ local used, locked = self:isSetUsed(set)
-- Pass to active selectors
for k,selector in pairs(self:getSelectorsActive()) do
selector:controlpressed(set, action, key)
end
- if not self:isSetUsed(set) then
+ if not used then
if action == "attack" then
self:getSelectorsInactive()[1]:assignControlSet(set)
end
@@ -201,7 +206,9 @@ function Menu:controlpressed(set, action, key)
end
-- speed up the countdown
if action ~= "jump" then
- self:countdownJump() -- that's funny isn't it? if not jump then jump
+ if set == nil or locked then
+ self:countdownJump() -- that's funny isn't it? if not jump then jump
+ end
end
end
function Menu:controlreleased(set, action, key)
diff --git a/world.lua b/world.lua
index c96ed33..8f948ce 100644
--- a/world.lua
+++ b/world.lua
@@ -220,11 +220,7 @@ function World:onNautKilled(naut)
self:createRay(naut)
local nauts = self:getNautsPlayable()
if self.lastNaut then
- local m = Menu:new()
- for _,controller in pairs(Controllers) do
- m:assignController(controller)
- end
- changeScene(m)
+ changeScene(Menu:new())
elseif #nauts < 2 then
self.lastNaut = true
end