From 8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Thu, 14 May 2026 09:09:08 -0700 Subject: Fixes crash on equip --- camera.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'camera.lua') diff --git a/camera.lua b/camera.lua index 22be0fc..b2dcf4c 100644 --- a/camera.lua +++ b/camera.lua @@ -3,7 +3,7 @@ SCREEN = vec2(128, 128) _chunk_size = vec2(100, 100) _chunk_size:apply(function (v) assert(v % 2 == 0) end) _padding = (SCREEN - _chunk_size) / 2 -_interpolate_step = 20 +_interpolate_step = 22 assert(_chunk_size.x < SCREEN.x and _chunk_size.y < SCREEN.y) Camera = {} @@ -39,8 +39,13 @@ function from_chunk(chunk) return chunk * _chunk_size end +_cull_factor = 1/4 function Camera:render(entity) screen_position = (entity.sprite_position or entity.position) - self.position + if not screen_position:in_bounds(SCREEN * -_cull_factor, SCREEN * (1 + _cull_factor)) then + return + end + entity:render(screen_position) end -- cgit v1.3