From 55cf1f028e58c7d3a3b996c96adea484363abe54 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 12 Sep 2017 17:40:53 +0200 Subject: Simplified Ray for now --- not/Ray.lua | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/not/Ray.lua b/not/Ray.lua index 9591591..4ae640a 100644 --- a/not/Ray.lua +++ b/not/Ray.lua @@ -15,40 +15,16 @@ function Ray:update (dt) return false end --- TODO: For some reason ray needs these 50s on camera boundaries. --- TODO: Ray draw should be cleaned-up and exploded into methods if possible. +-- TODO: Ray should use Camera boundaries just-in-case. +-- TODO: Ray uses magic numbers. function Ray:draw () love.graphics.setColor(255, 247, 228, 247) love.graphics.setLineStyle("rough") love.graphics.setLineWidth(self.delay*160) - -- point b top-left - -- point c bottom-right - -- point d ray start - -- point e ray end - local x, y = self.source:getPosition() - local bx, by, cx, cy = self.world.camera:getBoundaries() - local a = y / x - - bx = bx - 50 - by = by - 50 - cx = cx + 50 - cy = cy + 50 - - local dy, dx = bx * a, bx - if dy < by or dy > cy then - dy = by - dx = by / a - end - - local ey, ex = cx * a, cx - if ey < by or ey > cy then - ey = cy - ex = cy / a - end - love.graphics.line(dx, dy, ex, ey) + love.graphics.line(x, y, -x, -y) end return Ray -- cgit v1.1