From a62beaca5e30e01f500dc6afa1b49b6bfa332e23 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 7 Oct 2025 05:45:29 +0200 Subject: [PATCH] porjectile: projectile hitboxes are now smaller --- src/projectile.s | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/projectile.s b/src/projectile.s index 4ebb924..52d0db8 100644 --- a/src/projectile.s +++ b/src/projectile.s @@ -68,7 +68,7 @@ act_projectile_pistol_update: ld a, RF_PLAYER ld hl, tmp_rect - call actor_write_default_collider + call actor_projectile_write_default_collider ; check enemy collision pop de @@ -122,3 +122,30 @@ act_projectile_pistol_update_and_draw: ; bc: projectile act_projectile_pistol_col_res: ret + + + ; writes actor default projectile collider + ; based on an input position + ; writes the collider to dst + ; e.g. use with actor's real rectangle + ; if real collision should be written + ; use with tmp_rect for collision tests before moving + ; inputs: + ; a: collision mask + ; b/c: y/x position of actor + ; hl: destination rectangle +actor_projectile_write_default_collider: + ld [hl+], a ; mask + ld a, b + add a, 4 + ld [hl+], a ; y pos + + ld a, c + add a, 2 + ld [hl+], a ; x pos + + ld a, 4 ; width/height + ld [hl+], a ; height + + ld [hl+], a ; width + ret -- 2.30.2