summaryrefslogtreecommitdiffhomepage
path: root/world.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-06-01 22:24:38 +0200
committerAki <nthirtyone@gmail.com>2016-06-01 22:24:38 +0200
commit52609cc49d88f5b0d8610b5f6b792f0f423dc735 (patch)
tree4243590824e0f1b88ce3b568c483ef0af0a7b3f9 /world.lua
parent9ff0d70933474f3a7c50f7c3c0fa52fffaa9cf75 (diff)
downloadroflnauts-52609cc49d88f5b0d8610b5f6b792f0f423dc735.zip
roflnauts-52609cc49d88f5b0d8610b5f6b792f0f423dc735.tar.gz
roflnauts-52609cc49d88f5b0d8610b5f6b792f0f423dc735.tar.bz2
Menu menu menu -- still not complete
Diffstat (limited to 'world.lua')
-rw-r--r--world.lua15
1 files changed, 12 insertions, 3 deletions
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