From 21f09f86852d7b7b033057cb1c86e06e74acb7d5 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 22 May 2016 20:05:01 +0200 Subject: Debug draw upgrade --- ground.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ground.lua') 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 -- cgit v1.1