diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-12 17:40:53 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-12 17:40:53 +0200 |
commit | 55cf1f028e58c7d3a3b996c96adea484363abe54 (patch) | |
tree | c273ff1f9cabba217c22fcb561718e3874c675c6 | |
parent | 939a4dacec3bb1f7acff18f07eff74224ce8ad2c (diff) | |
download | roflnauts-55cf1f028e58c7d3a3b996c96adea484363abe54.zip roflnauts-55cf1f028e58c7d3a3b996c96adea484363abe54.tar.gz roflnauts-55cf1f028e58c7d3a3b996c96adea484363abe54.tar.bz2 |
Simplified Ray for now
-rw-r--r-- | not/Ray.lua | 30 |
1 files 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 |