Dev Individual
Member
What I'd like to do is that once my player runs out of lives, a game over screen gets displayed and then resets the game so it starts over at the title screen. Here is my code for "hurtPlayer_ArcadePlatformBase.asm":
The problem is, it only resets the game to the title screen, it doesn't take me to the game over screen I've made at x=7, y=14, or to any other screen. How can I fix this?
Code:
;;;;;;;;;;;;;;;;;; Presumes there is a variable called myLives defined in user variables.
LDA gameHandler
AND #%10000000
BEQ +canHurtPlayer
JMP +skipHurt
+canHurtPlayer:
; ;;;;;;;;;; is the monster below our feet?
; ;;;;;;;;;; and are we moving downward?
; LDA Object_v_speed_hi,x
; BEQ +doHurtPlayer ;; equal to zero
; BMI +doHurtPlayer ;; or negative
; ;; here we are moving downward.
; TXA
; PHA
; LDX otherObject
; DestroyObject
; PLA
; TAX
; ;; Do a hop
; LDA #$FC
; STA Object_v_speed_hi,x
; JMP +skipHurt
+doHurtPlayer
LDA Object_direction,x
AND #%00001111
STA Object_direction,x
PlaySound #sfx_Death
Dec myLives
LDA myLives
BNE myLivesNotZero
WarpToScreen #$0E, #$07, #$00
JMP +gameOver
;JMP RESET ;; game over.
;;;; also could warp to game over screen here instead.
+gameOver
JMP RESET
myLivesNotZero:
LDA continueMap
STA warpMap
LDA continueScreen
STA currentNametable
AND #%00001111
STA camX_hi
LDX player1_object
STA Object_screen,x
LDA #$02 ;; this is continue type warp.
STA screenTransitionType ;; is of warp type
LDA #$00
STA camX
LDA gameHandler
ORA #%10000000
STA gameHandler ;; this will set the next game loop to update the screen.
LDA warpMap
STA continueMap
+skipHurt
The problem is, it only resets the game to the title screen, it doesn't take me to the game over screen I've made at x=7, y=14, or to any other screen. How can I fix this?