summaryrefslogtreecommitdiffhomepage
path: root/world.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 /world.lua
parent13e368bc2c35c35369a1f6bf76778d88cae240da (diff)
downloadroflnauts-21f09f86852d7b7b033057cb1c86e06e74acb7d5.zip
roflnauts-21f09f86852d7b7b033057cb1c86e06e74acb7d5.tar.gz
roflnauts-21f09f86852d7b7b033057cb1c86e06e74acb7d5.tar.bz2
Debug draw upgrade
Diffstat (limited to 'world.lua')
-rw-r--r--world.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/world.lua b/world.lua
index 2580e0e..cb54b42 100644
--- a/world.lua
+++ b/world.lua
@@ -85,7 +85,7 @@ end
-- Add new platform to the world
function World:createPlatform(x, y, polygon, sprite)
- table.insert(self.Platforms, Ground:new(self.world, x, y, polygon, sprite))
+ table.insert(self.Platforms, Ground:new(self, self.world, x, y, polygon, sprite))
end
-- Add new naut to the world
@@ -205,6 +205,22 @@ function World:draw()
platform:draw(offset_x, offset_y, scale, debug)
end
+ -- draw center
+ if debug then
+ local c = self.camera
+ local w, h = love.graphics.getWidth(), love.graphics.getHeight()
+ love.graphics.setColor(130,130,130)
+ love.graphics.setLineWidth(1)
+ love.graphics.setLineStyle("rough")
+ local cx, cy = c:getPositionScaled()
+ local x1, y1 = c:translatePosition(self.map.center_x, cy)
+ local x2, y2 = c:translatePosition(self.map.center_x, cy+h)
+ love.graphics.line(x1,y1,x2,y2)
+ local x1, y1 = c:translatePosition(cx, self.map.center_y)
+ local x2, y2 = c:translatePosition(cx+w, self.map.center_y)
+ love.graphics.line(x1,y1,x2,y2)
+ end
+
-- Draw HUDs
for _,naut in pairs(self.Nauts) do
-- I have no idea where to place them T_T