summaryrefslogtreecommitdiffhomepage
path: root/not/PhysicalBody.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-04-03 17:34:03 +0200
committerAki <nthirtyone@gmail.com>2017-04-03 17:34:03 +0200
commit9af03e90acde019820021d0bc2fe546d10c25ed4 (patch)
tree4b02da243a359b9c359e098935126605c8c274d9 /not/PhysicalBody.lua
parentbda0f791d64178904e655f74efce24a2f3fc2f96 (diff)
downloadroflnauts-9af03e90acde019820021d0bc2fe546d10c25ed4.zip
roflnauts-9af03e90acde019820021d0bc2fe546d10c25ed4.tar.gz
roflnauts-9af03e90acde019820021d0bc2fe546d10c25ed4.tar.bz2
Setting group differently, moved debug draw to PhysicalBody from Hero
Diffstat (limited to 'not/PhysicalBody.lua')
-rw-r--r--not/PhysicalBody.lua12
1 files changed, 11 insertions, 1 deletions
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