diff options
author | Aki <nthirtyone@gmail.com> | 2016-08-14 23:08:38 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-08-14 23:08:38 +0200 |
commit | 22c36dfaac394ef8148d50a95c862e937b4e908a (patch) | |
tree | bb51799daa48252846c6786afd4bdbd77a71cd03 /menu.lua | |
parent | 7d4f54ff43c19d590f7dc3fb2803442b4b469ee6 (diff) | |
download | roflnauts-22c36dfaac394ef8148d50a95c862e937b4e908a.zip roflnauts-22c36dfaac394ef8148d50a95c862e937b4e908a.tar.gz roflnauts-22c36dfaac394ef8148d50a95c862e937b4e908a.tar.bz2 |
Moved love callbacks for readability
Diffstat (limited to 'menu.lua')
-rw-r--r-- | menu.lua | 76 |
1 files changed, 38 insertions, 38 deletions
@@ -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 |