summaryrefslogtreecommitdiff
path: root/camera.lua
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2026-05-28 21:01:02 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2026-05-28 21:01:02 -0700
commit16c1140ead99064799113eb3d8ddcf47929bba70 (patch)
tree39222a2af7491afaf0efd7fa9b5771d0283c78cc /camera.lua
parent661156ce988131eb4896a7af4d00a42b520305e7 (diff)
downloaddyl8-16c1140ead99064799113eb3d8ddcf47929bba70.tar.gz
dyl8-16c1140ead99064799113eb3d8ddcf47929bba70.zip
Adding debug collision boxes, making bullets hurt you, and be able to kill bullets upon consumptionHEADmain
Diffstat (limited to 'camera.lua')
-rw-r--r--camera.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/camera.lua b/camera.lua
index 6062ee7..bb69183 100644
--- a/camera.lua
+++ b/camera.lua
@@ -42,6 +42,12 @@ end
_cull_factor = 1/4
function Camera:render(entity)
screen_position = (entity.sprite_position or entity.position) - self.position
+ if DEBUG and entity.collision then
+ entity_collision_box = { top_left = screen_position + entity.collision_bounds.top_left, bottom_right = screen_position + entity.collision_bounds.bottom_right }
+ -- entity_collision_box = { top_left = screen_position, bottom_right = screen_position + vec2(8, 8)}
+ -- entity_collision_box = entity_collision_bounds
+ rect(entity_collision_box.top_left.x, entity_collision_box.top_left.y, entity_collision_box.bottom_right.x, entity_collision_box.bottom_right.y, 5)
+ end
if screen_position:in_bounds(SCREEN * -_cull_factor, SCREEN * (1 + _cull_factor)) then
entity:render(screen_position)
end