diff options
author | Aki <nthirtyone@gmail.com> | 2017-05-26 19:53:20 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-05-26 19:53:20 +0200 |
commit | 81e72006a4ca0578f0bbc31d0788a6e0223fdb63 (patch) | |
tree | 0349ee76d4e3a5b72274a584da4ebf111336b3de | |
parent | 62b67be7882dffebd6de0c8241d253d806a6905c (diff) | |
download | roflnauts-81e72006a4ca0578f0bbc31d0788a6e0223fdb63.zip roflnauts-81e72006a4ca0578f0bbc31d0788a6e0223fdb63.tar.gz roflnauts-81e72006a4ca0578f0bbc31d0788a6e0223fdb63.tar.bz2 |
Random changed to use love lib
-rw-r--r-- | not/World.lua | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/not/World.lua b/not/World.lua index b4ad4fa..38639b7 100644 --- a/not/World.lua +++ b/not/World.lua @@ -53,8 +53,6 @@ function World:init (map, nauts) self.Effects = {} self.Decorations = {} self.Rays = {} - -- Random init; TODO: use LOVE2D's random. - math.randomseed(os.time()) -- Map and misc. local map = map or "default" self:loadMap(map) @@ -110,7 +108,7 @@ end -- Get respawn location function World:getSpawnPosition () - local n = math.random(1, #self.map.respawns) + local n = love.math.random(1, #self.map.respawns) return self.map.respawns[n].x, self.map.respawns[n].y end @@ -151,13 +149,13 @@ function World:randomizeCloud (outside) local x,y,t,v local m = self.map if outside then - x = m.center_x-m.width*1.2+math.random(-50,20) + x = m.center_x-m.width*1.2+love.math.random(-50,20) else - x = math.random(m.center_x-m.width/2,m.center_x+m.width/2) + x = love.math.random(m.center_x-m.width/2,m.center_x+m.width/2) end - y = math.random(m.center_y-m.height/2, m.center_y+m.height/2) - t = math.random(1,3) - v = math.random(8,18) + y = love.math.random(m.center_y-m.height/2, m.center_y+m.height/2) + t = love.math.random(1,3) + v = love.math.random(8,18) self:createCloud(x, y, t, v) end |