BITVADER
Member
I'm suffering from a sudden game crash.
View: https://youtu.be/HANoZ_vlkEY
It seems that the behavior when "myLives" is zero is strange, but the result is different when touching the monster and when touching the pain tile.
Similar code, but when you touch the pain tile and "my Lives" goes to zero, you get the desired result.
It seems that the behavior when "myLives" is zero is strange, but the result is different when touching the monster and when touching the pain tile.
Similar code, but when you touch the pain tile and "my Lives" goes to zero, you get the desired result.
”PlayerHurt_MaseBase.asm”TXA
PHA
LDA gameHandler
AND #%10000000
BEQ +canHurtPlayer
JMP +skipHurt
+canHurtPlayer:
TXA
STA temp
GetActionStep temp
CMP #$07
BNE +canHurtPlayer
JMP +skipHurt
+canHurtPlayer
GetActionStep temp
CMP #$06
BNE +PsHurt
JMP +skipHurt
+PsHurt
DEC myLives
PlaySong #song_index_MISS
UpdateHudElement #$01
LDA myLives
BNE +notZeroLives
;;;zero lives
ChangeActionStep player1_object, #$06
;; 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
StopMoving temp, #$FF, #$00
;;WarpToScreen warpToMap, #$47, #$01
;; JMP RESET
RTS
+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
StopMoving temp, #$FF, #$00
+skipHurt
PLA
TAX
”playerHurt_recoil_MazeBase.asm”;;; Simple Reset
;; check to see if object colliding is a player.
;; if not, do not reset.
CPX player1_object
BEQ +doHurtRecoil
JMP +dontHurtRecoil
+doHurtRecoil
TXA
STA temp
GetActionStep temp
CMP #$07
BNE +canHurtPlayer
JMP +skipHurt
+canHurtPlayer
GetActionStep temp
CMP #$06
BNE +PsHurt
JMP +skipHurt
+PsHurt
DEC myLives
;;StopSound
PlaySong #song_index_MISS
ChangeTileAtCollision #$02, #$00
UpdateHudElement #$01
LDA myLives
BNE +notZeroLives
;;;zero lives
ChangeActionStep player1_object, #$06
;; 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
StopMoving temp, #$FF, #$00
;;WarpToScreen warpToMap, #$47, #$01
;; JMP RESET
RTS
+notZeroLives
ChangeActionStep player1_object, #$07
;;StopSound
;; 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
StopMoving temp, #$FF, #$00
+notAlreadyInHurtState
+skipHurt
+dontHurtRecoil:
Last edited: