summaryrefslogtreecommitdiffhomepage
path: root/ground.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-22 20:05:01 +0200
committerAki <nthirtyone@gmail.com>2016-05-22 20:05:01 +0200
commit21f09f86852d7b7b033057cb1c86e06e74acb7d5 (patch)
tree787c2ccfbb795c21a777335bdd0295e26cbbc9be /ground.lua
parent13e368bc2c35c35369a1f6bf76778d88cae240da (diff)
downloadroflnauts-21f09f86852d7b7b033057cb1c86e06e74acb7d5.zip
roflnauts-21f09f86852d7b7b033057cb1c86e06e74acb7d5.tar.gz
roflnauts-21f09f86852d7b7b033057cb1c86e06e74acb7d5.tar.bz2
Debug draw upgrade
Diffstat (limited to 'ground.lua')
-rw-r--r--ground.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/ground.lua b/ground.lua
index db3d090..d9d6bde 100644
--- a/ground.lua
+++ b/ground.lua
@@ -10,10 +10,11 @@ Ground = {
body = nil,
shape = nil,
fixture = nil,
+ world = nil,
sprite = nil
}
-- Constructor of `Ground`
-function Ground:new (world, x, y, shape, sprite)
+function Ground:new (game, world, x, y, shape, sprite)
local o = {}
setmetatable(o, self)
self.__index = self
@@ -23,6 +24,7 @@ function Ground:new (world, x, y, shape, sprite)
o.sprite = love.graphics.newImage(sprite)
o.fixture:setCategory(1)
o.fixture:setFriction(0.2)
+ o.world = game
return o
end
@@ -39,6 +41,6 @@ function Ground:draw (offset_x, offset_y, scale, debug)
-- debug draw
if debug then
love.graphics.setColor(220, 220, 220, 100)
- love.graphics.polygon("fill", self.body:getWorldPoints(self.shape:getPoints()))
+ love.graphics.polygon("fill", self.world.camera:translatePoints(self.body:getWorldPoints(self.shape:getPoints())))
end
end \ No newline at end of file