From 3787499248fdc2d2b881b20779911733eb2678ad Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 4 Jun 2016 15:14:05 +0200 Subject: Menu actually works now --- main.lua | 24 +++++++++++------------- menu.lua | 14 +++++++++----- nautslist.lua | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/main.lua b/main.lua index da4c378..8e2a964 100644 --- a/main.lua +++ b/main.lua @@ -9,6 +9,12 @@ require "controller" -- Temporary debug debug = false +-- Pretend you didn't see this +Scene = nil +function changeScene(scene) + Scene = scene +end + -- Load function love.load () -- Graphics @@ -34,14 +40,13 @@ function love.load () m:assignController(Controllers[1]) m:assignController(Controllers[2]) - -- ZU WARUDO! - w = World:new("default", {"leon", Controllers[1]}, {"lonestar", Controllers[2]}) + -- Scene + changeScene(m) end -- Update function love.update (dt) - w:update(dt) - -- m:update(dt) + Scene:update(dt) end -- KeyPressed @@ -59,13 +64,7 @@ function love.keypressed (key) end if key == "f5" and debug then local new = World:new("default", {"leon", Controllers[1]}, {"lonestar", Controllers[2]}) - -- m = nil - -- m = new - w = nil - w = new - end - if key == "f6" then - m = m:startGame() + changeScene(new) end end @@ -79,8 +78,7 @@ end -- Draw function love.draw () - w:draw() - -- m:draw() + Scene:draw() if debug then love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10) end diff --git a/menu.lua b/menu.lua index 6f0681c..72c2087 100644 --- a/menu.lua +++ b/menu.lua @@ -70,7 +70,7 @@ function Menu:update(dt) self.countdown = 3 end if state and self.countdown < 0 then - self.__index = self:startGame() + self:startGame() end end @@ -110,12 +110,16 @@ end function Menu:controllerReleased(control, controller) end --- WARUDO -function Menu:startGame() +function Menu:getNauts() local nauts = {} for _,selector in pairs(self.selected) do table.insert(nauts, {selector:getSelectionName(), selector:getController()}) end - local world = World:new("default", nauts) - return world + return nauts +end + +-- WARUDO +function Menu:startGame() + local world = World:new("default", self:getNauts()) + changeScene(world) end \ No newline at end of file diff --git a/nautslist.lua b/nautslist.lua index cfccb21..660347a 100644 --- a/nautslist.lua +++ b/nautslist.lua @@ -14,18 +14,18 @@ return { "skolldir", "yuri", "derpl", - "vinnie", - "genji", + --"vinnie", + --"genji", "swiggins", - "rocco", - "ksenia", + --"rocco", + --"ksenia", "ted", - "penny", - "sentry", + --"penny", + --"sentry", "skree", - "nibbs", - "yoolip", + --"nibbs", + --"yoolip", "chucho", - "lux", - "ix" + --"lux", + --"ix" } \ No newline at end of file -- cgit v1.1