diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-05 01:24:02 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-05 01:24:02 +0200 |
commit | b117c29325698e56a4fbd76426739dd48fa154cb (patch) | |
tree | 02f08cea1b5c002d9ebb298b55f3202e3d04f47f /not/World.lua | |
parent | fc16ad592a45648c7df7cc18c2b6cd153af238e3 (diff) | |
download | roflnauts-b117c29325698e56a4fbd76426739dd48fa154cb.zip roflnauts-b117c29325698e56a4fbd76426739dd48fa154cb.tar.gz roflnauts-b117c29325698e56a4fbd76426739dd48fa154cb.tar.bz2 |
Map config table is now passed to World rather than map name
Diffstat (limited to 'not/World.lua')
-rw-r--r-- | not/World.lua | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/not/World.lua b/not/World.lua index c3fec11..b2dc0e7 100644 --- a/not/World.lua +++ b/not/World.lua @@ -25,12 +25,13 @@ function World:new (map, nauts) self.Effects = {} self.Decorations = {} self.Rays = {} - -- Map and misc. - -- TODO: `map` could be table from config file rather than just string. - local map = map or "default" - self:loadMap(map) + + self.map = map + self:buildMap() self:spawnNauts(nauts) + self.camera = Camera:new(self) + musicPlayer:setTrack(self.map.theme) musicPlayer:play() end @@ -46,11 +47,8 @@ function World:delete () self.world:destroy() end ---- Loads table from selected map config file located in `config/maps/` directory. -function World:loadMap (name) - local map = string.format("config/maps/%s.lua", name or "default") - self.map = love.filesystem.load(map)() - +--- Builds map using one of tables frin config files located in `config/maps/` directory. +function World:buildMap () for _,op in pairs(self.map.create) do if op.platform then local path = string.format("config/platforms/%s.lua", op.platform) |