From 27a1d0de613a360912d1e9f3a5db7ab044a0b450 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 2 Sep 2017 21:16:30 +0200 Subject: Center_* changed to center.* (table) --- not/Camera.lua | 6 +++--- not/Hero.lua | 4 ++-- not/Ray.lua | 2 +- not/World.lua | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/not/Camera.lua b/not/Camera.lua index aa4df5b..183a323 100644 --- a/not/Camera.lua +++ b/not/Camera.lua @@ -108,11 +108,11 @@ end -- Move follow function Camera:follow () local map = self.world.map - local sum_x,sum_y,i = map.center_x, map.center_y, 1 + local sum_x,sum_y,i = map.center.x, map.center.y, 1 for k,naut in pairs(self.world.Nauts) do local naut_x,naut_y = naut:getPosition() - if math.abs(naut_x - map.center_x) < map.width/2 and - math.abs(naut_y - map.center_y) < map.height/2 then + if math.abs(naut_x - map.center.x) < map.width/2 and + math.abs(naut_y - map.center.y) < map.height/2 then i = i + 1 sum_x = naut_x + sum_x sum_y = naut_y + sum_y diff --git a/not/Hero.lua b/not/Hero.lua index 039aeb8..71cfb5b 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -87,8 +87,8 @@ function Hero:update (dt) -- TODO: World/Map function for testing if Point is inside playable area. local m = self.world.map local x, y = self:getPosition() - if (x < m.center_x - m.width*1.5 or x > m.center_x + m.width*1.5 or - y < m.center_y - m.height*1.5 or y > m.center_y + m.height*1.5) and + if (x < m.center.x - m.width*1.5 or x > m.center.x + m.width*1.5 or + y < m.center.y - m.height*1.5 or y > m.center.y + m.height*1.5) and self.isAlive then self:die() diff --git a/not/Ray.lua b/not/Ray.lua index 16a9bee..3c80440 100644 --- a/not/Ray.lua +++ b/not/Ray.lua @@ -35,7 +35,7 @@ function Ray:draw (offset_x, offset_y, scale) local x, y = self.naut:getPosition() local m = self.world.map local dy = m.height - if y > m.center_y then + if y > m.center.y then dy = -dy end love.graphics.line(-x+offset_x,-y+offset_y-dy*0.7,x+offset_x,y+dy*0.7+offset_y) diff --git a/not/World.lua b/not/World.lua index 55ea1d1..7d40476 100644 --- a/not/World.lua +++ b/not/World.lua @@ -120,11 +120,11 @@ function World:randomizeCloud (outside) local x,y,t,v local m = self.map if outside then - x = m.center_x-m.width*1.2+love.math.random(-50,20) + x = m.center.x-m.width*1.2+love.math.random(-50,20) else - x = love.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 = love.math.random(m.center_y-m.height/2, m.center_y+m.height/2) + 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) @@ -284,11 +284,11 @@ function World:draw () love.graphics.setLineWidth(1) love.graphics.setLineStyle("rough") local cx, cy = c:getPositionScaled() - local x1, y1 = c:translatePosition(self.map.center_x, cy) - local x2, y2 = c:translatePosition(self.map.center_x, cy+h) + local x1, y1 = c:translatePosition(self.map.center.x, cy) + local x2, y2 = c:translatePosition(self.map.center.x, cy+h) love.graphics.line(x1,y1,x2,y2) - local x1, y1 = c:translatePosition(cx, self.map.center_y) - local x2, y2 = c:translatePosition(cx+w, self.map.center_y) + local x1, y1 = c:translatePosition(cx, self.map.center.y) + local x2, y2 = c:translatePosition(cx+w, self.map.center.y) love.graphics.line(x1,y1,x2,y2) -- draw ox, oy love.graphics.setColor(200,200,200) -- cgit v1.1