diff options
author | Aki <nthirtyone@gmail.com> | 2016-05-22 19:51:51 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-05-22 19:51:51 +0200 |
commit | 13e368bc2c35c35369a1f6bf76778d88cae240da (patch) | |
tree | ba4ef5f8d966cb5ff6fc3d4255cd58ef762b34ee /world.lua | |
parent | 846debef23b584a3ebc16cbde3bea8d9c2d2b7c1 (diff) | |
download | roflnauts-13e368bc2c35c35369a1f6bf76778d88cae240da.zip roflnauts-13e368bc2c35c35369a1f6bf76778d88cae240da.tar.gz roflnauts-13e368bc2c35c35369a1f6bf76778d88cae240da.tar.bz2 |
More on maps
Diffstat (limited to 'world.lua')
-rw-r--r-- | world.lua | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -42,6 +42,11 @@ function World:new(map, ...) o.Effects = e -- Random init math.randomseed(os.time()) + -- Map + local map = map or "default" + o:loadMap(map) + -- Nauts + o:spawnNauts(...) -- Create camera o.camera = Camera:new(o) -- Cloud generator @@ -49,11 +54,6 @@ function World:new(map, ...) for i=1,5 do o:randomizeCloud(false) end - -- Map - local map = map or "default" - o:loadMap(map) - -- Nauts - o:spawnNauts(...) return o end @@ -106,12 +106,13 @@ function World:randomizeCloud(outside) outside = outside end local x,y,t,v + local m = self.map if outside then - x = -250+math.random(-30,30) + x = m.center_x-m.width+math.random(-30,30) else - x = math.random(-200,250) + x = math.random(m.center_x-m.width/2,m.center_x+m.width/2) end - y = math.random(-20, 170) + y = math.random(m.center_y-m.height/3, m.center_y+m.height/3) t = math.random(1,3) v = math.random(8,18) self:createCloud(x, y, t, v) |