diff options
author | Aki <nthirtyone@gmail.com> | 2016-05-22 22:20:45 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-05-22 22:20:45 +0200 |
commit | e138fff2cafd100e10113bfb23e005870ab36642 (patch) | |
tree | f6592dd4fd4715e315e8024595ff1e3a5c5e6be3 | |
parent | a8c3aba91e994c29b224279d401691ae39412db1 (diff) | |
download | roflnauts-e138fff2cafd100e10113bfb23e005870ab36642.zip roflnauts-e138fff2cafd100e10113bfb23e005870ab36642.tar.gz roflnauts-e138fff2cafd100e10113bfb23e005870ab36642.tar.bz2 |
Small tweak
-rw-r--r-- | camera.lua | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -24,6 +24,8 @@ function Camera:new (world) setmetatable(o, self) self.__index = self o.world = world + o:setPosition(o:follow()) + o:setDestination(o:follow()) return o end @@ -118,9 +120,9 @@ function Camera:follow () y = point.body:getY() + y end end - x = x / i - love.graphics.getWidth()/2/self.scale - y = y / i - love.graphics.getHeight()/2/self.scale - self:setDestination(x,y) + x = x / i - love.graphics.getWidth()/self.scale/2 + y = y / i - love.graphics.getHeight()/self.scale/2 + return x,y end -- Update @@ -134,7 +136,7 @@ function Camera:update (dt) self.delay = self.delay - dt end else - self:follow() + self:setDestination(self:follow()) end local dx, dy = self:getDestination() dx = (dx - self.x) * 6 * dt |