I notice certain collisions with monsters, they'll take all the players lives. it seems to ignore the players hurt state. 9/10 times when I collide with a monster the player object will flash orange, which is my action state 07. then the screen will reset. The odd time I collide with a monster they wipe out all my lives. In the video this is a spot I can sometimes reproduce this happening. You can see that I do flash orange very quickly showing it did go to my hurt state but continued hurting the player anyways. My Player hurt code below.
View: https://www.youtube.com/watch?v=vGuO41f3Rc4
Code:
TXA
PHA
LDA gameHandler
AND #%10000000
BEQ +canHurtPlayer
JMP +skipHurt
+canHurtPlayer:
TXA
STA temp
GetActionStep temp
CMP #$07
BNE +canHurtPlayer
JMP +skipHurt
+canHurtPlayer
GetActionStep player1_object
CMP #$06 ;;;victory action state once all prizes collected
BNE +canHurtPlayer
JMP +skipHurt
+canHurtPlayer
DEC myLives
UpdateHudElement #$01
LDA myLives
BNE +notZeroLives
;;;zero lives
;JMP RESET
WarpToScreen #$00, #$E0, #$01
;; arg0 = warp to map. 0= map1. 1= map2.
;; arg1 = screen to warp to.
;; arg2 = screen transition type - most likely use 1 here.
;; 1 = warp, where it observes the warp in position for the player.
+notZeroLives
ChangeActionStep player1_object, #$07
;; recoil
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
; LDA xPrev
; STA Object_x_hi,x
; LDA yPrev
; STA Object_y_hi,x
+skipHurt
PLA
TAX