summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-07-31 09:00:57 +0200
committerAki <nthirtyone@gmail.com>2016-07-31 09:00:57 +0200
commit95751a8ba1a2881972ab50fabc72526ee989a29f (patch)
treebf126a8a7c4e42f238ab5178d9bb01e8d67329f4
parentd38941d363842f547ba3cd681ca22f2014f1ba49 (diff)
downloadroflnauts-95751a8ba1a2881972ab50fabc72526ee989a29f.zip
roflnauts-95751a8ba1a2881972ab50fabc72526ee989a29f.tar.gz
roflnauts-95751a8ba1a2881972ab50fabc72526ee989a29f.tar.bz2
Map restart
-rw-r--r--main.lua7
-rw-r--r--maps/default.lua3
-rw-r--r--world.lua10
3 files changed, 17 insertions, 3 deletions
diff --git a/main.lua b/main.lua
index 95ce865..445ed6f 100644
--- a/main.lua
+++ b/main.lua
@@ -106,7 +106,12 @@ function love.keypressed(key)
love.event.quit()
end
if key == "f6" and debug then
- local new = World:new("default", {"link", Controllers[1]}, {"weed", Controllers[2]})
+ local map = Scene:getMapName()
+ local nauts = {}
+ for _,naut in pairs(Scene:getNautsAll()) do
+ table.insert(nauts, {naut.name, naut.controller})
+ end
+ local new = World:new(map, nauts)
Scene:delete()
changeScene(new)
end
diff --git a/maps/default.lua b/maps/default.lua
index 3fc6b04..ee64830 100644
--- a/maps/default.lua
+++ b/maps/default.lua
@@ -1,6 +1,7 @@
-- Default map from original roflnauts
return {
- -- CENTER AND SIZE
+ -- GENERAL
+ name = "default",
center_x = 0,
center_y = 0,
width = 360,
diff --git a/world.lua b/world.lua
index bd3b392..a69b532 100644
--- a/world.lua
+++ b/world.lua
@@ -189,7 +189,6 @@ function World:getNautsPlayable()
end
return nauts
end
-
-- are alive
function World:getNautsAlive()
local nauts = {}
@@ -200,6 +199,15 @@ function World:getNautsAlive()
end
return nauts
end
+-- all of them
+function World:getNautsAll()
+ return self.Nauts
+end
+
+-- get Map name
+function World:getMapName()
+ return self.map.name
+end
-- Event: when player is killed
function World:onNautKilled(naut)