porjectile: Added player check
authorLukas Krickl <lukas@krickl.dev>
Sat, 4 Oct 2025 05:58:56 +0000 (07:58 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 4 Oct 2025 05:58:56 +0000 (07:58 +0200)
src/projectile.s

index e193c476ef9946c2f84b7bf56c66b207658651d8..4ebb924e281754ff71266e81057c959818fca7c3 100644 (file)
@@ -32,13 +32,24 @@ act_spawn_projectile_pistol_player:
        ld a, PROJECTILE_F_PLAYER
        ld [hl], a
 
-
        ret
 
        ; updates a simple pistol projectile
        ; inputs:
        ;               de: actor ptr
 act_projectile_pistol_update:
+       ; is this a player actor?
+       ld hl, act_p0
+       add hl, de 
+       ld a, [hl] ; load projectile p0 flags
+       and a, PROJECTILE_F_PLAYER
+       jp nz, @player
+       
+       ; TODO:
+       ; enemy projectile logic
+
+       ret
+@player:
        ld hl, act_pos_y
        add hl, de
 
@@ -52,7 +63,7 @@ act_projectile_pistol_update:
        ld b, a
        ld a, [hl]
        ld c, a ; c = x pos
-       
+
        push de 
        
        ld a, RF_PLAYER
@@ -60,8 +71,6 @@ act_projectile_pistol_update:
        call actor_write_default_collider
 
        ; check enemy collision
-       ; TODO: if player projectile check enemies, otherwise
-       ; check player
        pop de
        push de