From 9af03e90acde019820021d0bc2fe546d10c25ed4 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 3 Apr 2017 17:34:03 +0200 Subject: Setting group differently, moved debug draw to PhysicalBody from Hero --- not/PhysicalBody.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'not/PhysicalBody.lua') diff --git a/not/PhysicalBody.lua b/not/PhysicalBody.lua index 54d334f..24e87c8 100644 --- a/not/PhysicalBody.lua +++ b/not/PhysicalBody.lua @@ -54,6 +54,16 @@ end -- Draw of `PhysicalBody`. function PhysicalBody:draw (offset_x, offset_y, scale, debug) - -- TODO: Move debug part here from `not.Hero.draw`. Sprite.draw(self, offset_x, offset_y, scale) + if debug then + for _,fixture in pairs(self.body:getFixtureList()) do + if fixture:getCategory() == 2 then + love.graphics.setColor(137, 255, 0, 120) + else + love.graphics.setColor(137, 0, 255, 40) + end + -- TODO: `world` is not a member of `PhysicalBody` or its instance normally. + love.graphics.polygon("fill", self.world.camera:translatePoints(self.body:getWorldPoints(fixture:getShape():getPoints()))) + end + end end -- cgit v1.1