take damage code is now only run when the player is not in iframe mode
authorLukas Krickl <lukas@krickl.dev>
Wed, 9 Oct 2024 04:02:02 +0000 (06:02 +0200)
committerLukas Krickl <lukas@krickl.dev>
Wed, 9 Oct 2024 04:02:02 +0000 (06:02 +0200)
src/player.s

index 3b39871e37b07ec4473adb4b6ea92b6bc366168b..7a1ed33c65ccff1ea7290d7a4b1880496065538c 100644 (file)
@@ -273,6 +273,16 @@ player_use_resource:
 player_take_damage:
   ld [tmp], a ; tmp store a
 
+  ; if iframes are on, do nothing 
+  push hl
+  ld de, player_timer_i ; go to timer 
+  add hl, de 
+  ld a, [hl] ; load timer into a
+  pop hl ; back to base
+  cp a, 0
+  ret nz
+
+
   ; set damage anim timer 
   ld a, DAMAGE_ANIM_LEN 
   ld [damage_anim], a