JewelianPerez_27
Member
I've been having this issue for a while now, and have been struggling with finding the solution. When losing a life in the underworld, I'm taken to the screen where my checkpoint is located, but on the overworld. (Losing a life in the overworld works fine). Here are the scripts for losing a life, checkpoints and timerendscripts. Where can this be fixed?
For further context, when my player loses a life, the player sprite turns off and creates a new object in its place. I have my player's death object set to "go to continue."
Player Death Script:
Checkpoint Tile:
TimerEndScripts:
For further context, when my player loses a life, the player sprite turns off and creates a new object in its place. I have my player's death object set to "go to continue."
Player Death Script:
Code:
;;; Player death
doHandleKillPlayer1:
LDX player1_object
LDA Object_x_hi,x
CLC
LDA continueMap
STA warpToMap
STA continueMap ;;;;;
LDA continueX
STA newX
LDA continueY
STA newY
LDA continueScreen
STA warpToScreen
STA camScreen
;Get position where the player death object should be created (same as player object)
makeDeathObject:
LDA Object_x_hi,x
STA tempA
LDA Object_y_hi,x
STA tempB
LDA Object_screen,x
STA tempD
;StopSound
;PlaySound #sfx_lose
;Disable player sprite
LDA Object_status,x
AND #%11000001
STA Object_status,x
;Disable other sprites
;LDX otherObject
;DestroyObject
;LDA Object_status,x
;AND #%11000001
;STA Object_status,x
;Stop scrolling
;LDA scrollByte
;AND #%00111110
;ORA #%00000010
;STA scrollByte
;Reset player health
;LDA myMaxHealth
;STA Object_health,x
;STA myHealth
;Stop player horizontal speed
LDA #0
STA Object_h_speed_hi,x
;Create player death object
CreateObjectOnScreen tempA, tempB, #$0D, #0, tempD
RTS
Checkpoint Tile:
Code:
;;; sets a new player continue checkpoint.
LDA updateScreenData
AND #%00000100
BEQ +doScript
;; wait until tile update is finished.
RTS
+doScript
CPX player1_object
BEQ +doCheckpoint
JMP +skip
+doCheckpoint
LDA currentNametable
STA continueScreen
LDA Object_x_hi,x
STA continueX
LDA Object_y_hi,x
STA continueY
STA continueMap ;;;;;
;ChangeTileAtCollision #$00, #$00 ;; change to tile zero (make disappear), collision type 0
+skip
TimerEndScripts:
Code:
;;; 09 = Go To Continue
goToContinue_action:
;; if no more lives, warp to GAME OVER:
LDA myLives
BEQ +notMoreLives
DEC myLives
BEQ +notMoreLives
BMI +notMoreLives
;; player still have lives, warp to last checkpoint:
LDA continueMap
STA warpToMap
LDA continueScreen
STA warpToScreen
LDA #$02
STA screenTransitionType
JMP +doWarpToContinue
+notMoreLives:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; THE PART HERE RESETS YOUR SCORE 8 DIGITS ;;;;
LDA #$00
STA myScore
STA myScore+1
STA myScore+2
STA myScore+3
STA myScore+4
STA myScore+5
STA myScore+6
STA myScore+7
LDA #$00
STA myAmmo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; no more lives:
LDA #$00 ;; 00: Overworld, 01: Underworld
STA warpToMap
LDA #$FF ;; screen Y:15, X:15 (our GAME OVER screen)
STA warpToScreen
LDA #$01
STA screenTransitionType
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; when game over cash resets to zero ;;
LDA #$00
STA myCash
STA myCash+1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+doWarpToContinue:
LDA myMaxHealth
STA myHealth
WarpToScreen warpToMap, warpToScreen, #$02 ;screenTransitionType
ChangeActionStep player1_object, #$00
LDX player1_object
LDA #$00000000
STA Object_direction,x
RTS