diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-11 19:54:14 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-11 19:54:14 +0200 |
commit | 4490b5b5fcaddbf55fb229caeb93c879fe254292 (patch) | |
tree | 99b9bc95a87e53c93393e71ee9556bc369ebda2e /not/Camera.lua | |
parent | 81ec1a6509b0f349c145dd1b4d40029d141cbd6e (diff) | |
download | roflnauts-4490b5b5fcaddbf55fb229caeb93c879fe254292.zip roflnauts-4490b5b5fcaddbf55fb229caeb93c879fe254292.tar.gz roflnauts-4490b5b5fcaddbf55fb229caeb93c879fe254292.tar.bz2 |
Layer displacement ratio added to new Camera and to World for tests
Diffstat (limited to 'not/Camera.lua')
-rw-r--r-- | not/Camera.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/not/Camera.lua b/not/Camera.lua index 025e9e5..4f57327 100644 --- a/not/Camera.lua +++ b/not/Camera.lua @@ -22,9 +22,15 @@ function Camera:initShake () end -- TODO: Even more magic numbers present in Camera. Translate method. -function Camera:translate () +function Camera:translate (ratio) local x, y = self:getPositionScaled() local dx, dy = self:getShakeScaled() + if ratio then + dx = dx * ratio + dy = dy * ratio + x = x * ratio + y = y * ratio + end love.graphics.push() love.graphics.translate(160*getScale() - x - dx, 100*getScale() - y - dy) end |