diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-05-14 09:09:08 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-05-14 09:09:08 -0700 |
| commit | 8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce (patch) | |
| tree | 07d56ae38d4131e571932322b3c5061d12bbd8d6 /camera.lua | |
| parent | e51b2ab9998588d2c4c842d861806c81011d751b (diff) | |
| download | dyl8-8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce.tar.gz dyl8-8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce.zip | |
Fixes crash on equip
Diffstat (limited to 'camera.lua')
| -rw-r--r-- | camera.lua | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |
