summaryrefslogtreecommitdiffhomepage
path: root/not/Camera.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-08-13 02:26:55 +0200
committerAki <nthirtyone@gmail.com>2017-08-13 02:26:55 +0200
commitb1cf14d64a2d3e28683db87190c4b2c7799c259d (patch)
treee45dac5cc6ce5265e3e3e2c914eb7cc92a820b8b /not/Camera.lua
parent0dd01913fe0eefc7ba4bc0797877f40fdedf9315 (diff)
parented62b573417bdc85bec616f6016846b02de4c906 (diff)
downloadroflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.zip
roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.gz
roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.bz2
Merge branch 'multi'maps
Diffstat (limited to 'not/Camera.lua')
-rw-r--r--not/Camera.lua14
1 files changed, 6 insertions, 8 deletions
diff --git a/not/Camera.lua b/not/Camera.lua
index 63489f3..aa4df5b 100644
--- a/not/Camera.lua
+++ b/not/Camera.lua
@@ -5,8 +5,6 @@ Camera = {
y = 0,
dest_x = 0,
dest_y = 0,
- scale = getScale(),
- scaler = getRealScale(),
shake = 0,
timer = 0,
delay = 0,
@@ -45,7 +43,7 @@ function Camera:getPosition ()
end
function Camera:getPositionScaled ()
- return self.x*self.scale, self.y*self.scale
+ return self.x*getScale(), self.y*getScale()
end
-- Destination
@@ -63,7 +61,7 @@ end
function Camera:translatePosition (x, y)
local x = x or 0
local y = y or 0
- return (x-self.x)*self.scale, (y-self.y)*self.scale
+ return (x-self.x)*getScale(), (y-self.y)*getScale()
end
function Camera:translatePoints(...)
@@ -72,9 +70,9 @@ function Camera:translatePoints(...)
local x,y = self:getOffsets()
for k,v in pairs(a) do
if k%2 == 1 then
- table.insert(r, (v + x) * self.scale)
+ table.insert(r, (v + x) * getScale())
else
- table.insert(r, (v + y) * self.scale)
+ table.insert(r, (v + y) * getScale())
end
end
return r
@@ -120,8 +118,8 @@ function Camera:follow ()
sum_y = naut_y + sum_y
end
end
- local x = sum_x / i - love.graphics.getWidth()/self.scale/2
- local y = sum_y / i - love.graphics.getHeight()/self.scale/2 + 4*self.scale -- hotfix
+ local x = sum_x / i - love.graphics.getWidth()/getScale()/2
+ local y = sum_y / i - love.graphics.getHeight()/getScale()/2 + 4*getScale() -- hotfix
return x,y
end