porjectile: projectile hitboxes are now smaller
authorLukas Krickl <lukas@krickl.dev>
Tue, 7 Oct 2025 03:45:29 +0000 (05:45 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 7 Oct 2025 03:45:29 +0000 (05:45 +0200)
src/projectile.s

index 4ebb924e281754ff71266e81057c959818fca7c3..52d0db894a63a53a1a91a935fcc08c2ea333a98f 100644 (file)
@@ -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