diff --git a/game/main.fnl b/game/main.fnl index 2876e73..b85be45 100644 --- a/game/main.fnl +++ b/game/main.fnl @@ -9,7 +9,7 @@ (local dev (require "src/levels/dev.fnl")) (local level dev) -(local debug false) +(local debug true) (var pool nil) diff --git a/game/src/entities/player.fnl b/game/src/entities/player.fnl index e21ce3d..b6fdb16 100644 --- a/game/src/entities/player.fnl +++ b/game/src/entities/player.fnl @@ -98,11 +98,28 @@ (. self.quads (angle-to-direction player.rot)) (- self.x 3) (- self.y 7))) + +(lambda draw-vision-debug [self] + "draw debug lines and points for player vision" + (color.set-color :black) + (love.graphics.push) + (let [ox (+ self.x (/ width 2)) + oy (+ self.y (/ height 2)) + steps 20 + vision-step (/ (/ math.pi 2) steps)] ; 90 deg / 20 + (love.graphics.translate ox oy) + (love.graphics.rotate (- self.rot (/ (* steps vision-step) 2))) + (for [i 1 steps] + (love.graphics.rotate vision-step) + (love.graphics.line 0 0 50 0)) + (love.graphics.pop))) + (fn player.draw-debug [self] "draw player hitbox and direction line" (color.set-color :black) + (draw-vision-debug self) (love.graphics.rectangle "line" self.x self.y width height) - (love.graphics.rectangle "line" self.x self.y 1 1) + ; (love.graphics.rectangle "line" self.x self.y 1 1) (love.graphics.push) (let [ox (+ self.x (/ width 2)) oy (+ self.y (/ height 2))] (love.graphics.translate ox oy) diff --git a/game/src/systems/fog_of_war.fnl b/game/src/systems/fog_of_war.fnl index c3a5007..6c17635 100644 --- a/game/src/systems/fog_of_war.fnl +++ b/game/src/systems/fog_of_war.fnl @@ -28,7 +28,7 @@ (let [ previousCanvas (love.graphics.getCanvas)] (love.graphics.setCanvas self.canvas) (color.set-color :dark-purple) - (love.graphics.rectangle "fill" 0 0 1000 1000) + ; (love.graphics.rectangle "fill" 0 0 1000 1000) (love.graphics.setCanvas previousCanvas) ))