player: Shooting is now on a timer
authorLukas Krickl <lukas@krickl.dev>
Mon, 29 Sep 2025 14:58:59 +0000 (16:58 +0200)
committerLukas Krickl <lukas@krickl.dev>
Mon, 29 Sep 2025 14:58:59 +0000 (16:58 +0200)
src/defs.s
src/player.s
src/wram.s

index b0b0399f157727362e64330c4a6926c7be284bab..350fc6c0de39bb4145676de8b6ba17c3b8f8a827 100644 (file)
@@ -13,7 +13,7 @@
 
 #define NULL 0
 
-#define ACTS_PLAYER_PROJECTILES 3
+#define ACTS_PLAYER_PROJECTILES 6
 #define ACTS_ENEMY 6
 #define ACTS_ENEMY_PROJECTILES 6
 #define ACTS_MAX (ACTS_PLAYER_PROJECTILES + ACTS_ENEMY + ACTS_ENEMY_PROJECTILES) 
index 98f2e17de6ed3fc51421fbbac974ab1a30eac0dd..5e751d3c6040ea200e1deb1d4d93f20a9c0d1221 100644 (file)
@@ -69,7 +69,7 @@ player_update:
 @not_right:
 
        ld b, BTNA
-       input_just
+       input_held
        jr z, @not_a REL
                call player_shoot
 @not_a:                
@@ -259,9 +259,15 @@ player_draw:
        ld a, 8
        call actor_draw
        ret
-       
+
+
+#define PLAYER_SHOOT_DELAY 15 
        ; shoots the player's current weapon
 player_shoot:
+       ld a, [player_shoot_delay]
+       cp a, 0
+       jp nz, @tick
+
        ; TODO: check player curr weapon
 
        call actor_try_add_player_projectile
@@ -270,6 +276,14 @@ player_shoot:
        ret z
 
        call act_spawn_projectile_pistol_player
+       
+       ld a, PLAYER_SHOOT_DELAY
+       ld [player_shoot_delay], a
+
+       ret
+@tick:
+       dec a
+       ld [player_shoot_delay], a
        ret
        
        ; combination of update and draw call
index d04901ead9bb8382cfd51282d3607336e2af037f..f5f6ffe242d5c24cd719768c63aa625c23e1d40e 100644 (file)
@@ -62,7 +62,8 @@ srand: .adv 2
        ; if player y < next_scroll
        ; advance if possible
 player_next_scroll_y: .adv 1
-
+       
+player_shoot_delay: .adv 1
 
 ; y/x sub pixel movement for player
 player_sub_pixel_y: .adv 1