From 52609cc49d88f5b0d8610b5f6b792f0f423dc735 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 1 Jun 2016 22:24:38 +0200 Subject: Menu menu menu -- still not complete --- world.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'world.lua') diff --git a/world.lua b/world.lua index 86ba1e3..c11855d 100644 --- a/world.lua +++ b/world.lua @@ -75,10 +75,17 @@ end -- Spawn all the nauts for the round function World:spawnNauts(...) - local nauts = {...} + local params = {...} + local nauts = nil + if type(params[1][1]) == "table" then + nauts = params[1] + else + nauts = params + end for _,naut in pairs(nauts) do local x,y = self:getSpawnPosition() - self:createNaut(x, y, naut) + local spawn = self:createNaut(x, y, naut[1]) + spawn:assignController(naut[2]) end end @@ -95,7 +102,9 @@ end -- Add new naut to the world function World:createNaut(x, y, name) - table.insert(self.Nauts, Player:new(self, self.world, x, y, name)) + local naut = Player:new(self, self.world, x, y, name) + table.insert(self.Nauts, naut) + return naut end -- Add new cloud to the world -- cgit v1.1