diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-11 19:22:18 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-11 19:22:18 +0200 |
commit | 81ec1a6509b0f349c145dd1b4d40029d141cbd6e (patch) | |
tree | 9e8f9211974ca5559d144e43307963972f5c744e /not/World.lua | |
parent | 9ddacd0f6481661cdaeab8abf2000b45a296faee (diff) | |
download | roflnauts-81ec1a6509b0f349c145dd1b4d40029d141cbd6e.zip roflnauts-81ec1a6509b0f349c145dd1b4d40029d141cbd6e.tar.gz roflnauts-81ec1a6509b0f349c145dd1b4d40029d141cbd6e.tar.bz2 |
Debug drawing changed to use new Camera properly
Diffstat (limited to 'not/World.lua')
-rw-r--r-- | not/World.lua | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/not/World.lua b/not/World.lua index aeed245..63d1182 100644 --- a/not/World.lua +++ b/not/World.lua @@ -147,7 +147,7 @@ end function World:getNautsAll () local nauts = {} for i,entity in ipairs(self.entities) do - if entity:is(require("not.Hero")) then + if entity:is(require("not.Hero")) and not entity.body:isDestroyed() then table.insert(nauts, entity) end end @@ -271,33 +271,23 @@ function World:draw () for _,naut in pairs(self:getNautsAlive()) do naut:drawTag(offset_x, offset_y, scale) end - self.camera:pop() - + if debug then - local c = self.camera - local w, h = love.graphics.getWidth(), love.graphics.getHeight() - -- draw map center - love.graphics.setColor(130,130,130) + local center = self.map.center + local ax, ay, bx, by = self.camera:getBoundariesScaled() + 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) - -- draw ox, oy + + love.graphics.setColor(130,130,130) + love.graphics.line(ax,center.y,bx,center.y) + love.graphics.line(center.x,ay,center.x,by) + love.graphics.setColor(200,200,200) - love.graphics.setLineStyle("rough") - local cx, cy = c:getPositionScaled() - local x1, y1 = c:translatePosition(0, cy) - local x2, y2 = c:translatePosition(0, cy+h) - love.graphics.line(x1,y1,x2,y2) - local x1, y1 = c:translatePosition(cx, 0) - local x2, y2 = c:translatePosition(cx+w, 0) - love.graphics.line(x1,y1,x2,y2) + love.graphics.line(ax,0,bx,0) + love.graphics.line(0,ay,0,by) end + self.camera:pop() for _,naut in pairs(self:getNautsAll()) do -- I have no idea where to place them T_T |