summaryrefslogtreecommitdiffhomepage
path: root/menu.lua
diff options
context:
space:
mode:
Diffstat (limited to 'menu.lua')
-rw-r--r--menu.lua76
1 files changed, 38 insertions, 38 deletions
diff --git a/menu.lua b/menu.lua
index 5b84f83..cfce246 100644
--- a/menu.lua
+++ b/menu.lua
@@ -107,6 +107,44 @@ function Menu:getBounce(f)
return math.sin(self.header_move*f*math.pi)
end
+-- Speed up countdown
+function Menu:countdownJump()
+ if self.countdown ~= Menu.countdown then -- Menu.countdown is initial
+ self.countdown = self.countdown - 1
+ end
+end
+
+-- Called when selector is deactivated
+function Menu:unselectSelector(selector)
+ local i = 0
+ for _,v in pairs(self:getSelectorsActive()) do
+ if v == selector then
+ i = _
+ break
+ end
+ end
+ if i ~= 0 then
+ self:assignController(selector:getController())
+ selector:clear()
+ end
+end
+
+-- Get table of nauts currently selected by active selectors
+function Menu:getNauts()
+ local nauts = {}
+ for _,selector in pairs(self:getSelectorsActive()) do
+ table.insert(nauts, {selector:getSelectionName(), selector:getController()})
+ end
+ return nauts
+end
+
+-- WARUDO
+function Menu:startGame()
+ local world = World:new(self.maplist[self.map], self:getNauts())
+ changeScene(world)
+end
+
+-- LÖVE2D callbacks
-- Update
function Menu:update(dt)
local state = true
@@ -131,7 +169,6 @@ function Menu:update(dt)
self.header_move = self.header_move - 2
end
end
-
-- Draw
function Menu:draw()
-- locals
@@ -160,43 +197,6 @@ function Menu:draw()
end
end
--- Speed up countdown
-function Menu:countdownJump()
- if self.countdown ~= Menu.countdown then -- Menu.countdown is initial
- self.countdown = self.countdown - 1
- end
-end
-
--- Called when selector is deactivated
-function Menu:unselectSelector(selector)
- local i = 0
- for _,v in pairs(self:getSelectorsActive()) do
- if v == selector then
- i = _
- break
- end
- end
- if i ~= 0 then
- self:assignController(selector:getController())
- selector:clear()
- end
-end
-
--- Get table of nauts currently selected by active selectors
-function Menu:getNauts()
- local nauts = {}
- for _,selector in pairs(self:getSelectorsActive()) do
- table.insert(nauts, {selector:getSelectionName(), selector:getController()})
- end
- return nauts
-end
-
--- WARUDO
-function Menu:startGame()
- local world = World:new(self.maplist[self.map], self:getNauts())
- changeScene(world)
-end
-
-- Controller callbacks
function Menu:controlpressed(set, action, key)
-- assign to character selection