Warp to game over screen

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":

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?
 

BITVADER

Member
Hello
When I make the player jump to the game over screen, set the end action after a mistake to "Go To Continue", and write a description to check the remaining life in "TimerEndScripts.asm", even if it is 0 I'm trying to jump to the game over screen.
This method seems to work well and I haven't had any problems so far.
 
I'm still new to coding in assembly, so I'm not entirely sure how to do that. Here's my code from my "TimerEndScripts.asm"

Code:
;;; 00 = Loop
end_loop_action:

    RTS
;;; 01 = Advance
advance_action:
        LDA Object_frame,x
        LSR
        LSR
        LSR
        AND #%00000111
        CLC
        ADC #$01
        AND #%00000111
        STA tempB
        ;STA tempD ;; the action frame that was assigned during create macro.
        ;;;; object behavior tables are with the lut table.
        ;;;; the lut table is in bank 1C.
        ; SwitchBank #$1C
            ; ;;; Then, get the behavior for that object on that frame number.
            ; LDY Object_type,x
            ; LDA ObjectBehaviorTableLo,y
            ; STA pointer
            ; LDA ObjectBehaviorTableHi,y
            ; STA pointer+1
            ; LDY tempD
            ; LDA (pointer),y
            ; AND #%00001111
            ; STA tempB
        ; ReturnBank
        LDA tempB
        ASL
        ASL
        ASL
        STA tempC
        LDA Object_frame,x
        AND #%11000111
        ORA tempC
        STA Object_frame,x

        TXA
        STA tempA
        
        DoObjectAction tempA, tempB
    ;    ;arg0 = what object?
        ;arg1 = what step behavior?
    RTS
;;; 02 = Repeat
repeat_action:
    LDA Object_frame,x
        LSR
        LSR
        LSR
        AND #%00000111
        STA tempB
    
        TXA
        STA tempA

        DoObjectAction tempA, tempB
    ;    ;arg0 = what object?
        ;arg1 = what step behavior?
    RTS
;;; 03 = Go To First
goToFirst_action:

            LDA #$00
            STA tempB
        ;;;; HURT END
        LDA Object_frame,x
        AND #%00111000
        CMP #%00111000
        BNE +notHurtFrame
            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 Object_direction,x
            AND #%00001111
            STA Object_direction,x
        ;;;;;;;;;;;;;;;;;;;;
        +notHurtFrame
        
        LDA Object_frame,x
        AND #%11000111
        STA Object_frame,x
        
    
        TXA
        STA tempA
        
        DoObjectAction tempA, tempB
    ;    ;arg0 = what object?
        ;arg1 = what step behavior?
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
         ;; turn off move towards point if current action is 7.
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    RTS
;;; 04 = Go To Last
goToLast_action:
            LDA #$07
            STA tempB
    
        
        LDA Object_frame,x
        ora #%00111000
        STA Object_frame,x
        
        TXA
        STA tempA
        
        DoObjectAction tempA, tempB
    ;    ;arg0 = what object?
        ;arg1 = what step behavior?
    RTS
;;; 05 = Go To Previous
goToPrev_action:
        LDA Object_frame,x
    LDA Object_frame,x
        LSR
        LSR
        LSR
        AND #%00000111
        SEC
        SBC #$01
        AND #%00000111
        STA tempB ;; the action frame that was assigned during create macro.
        ;;;; object behavior tables are with the lut table.
        ;;;; the lut table is in bank 1C.
        ASL
        ASL
        ASL
        STA tempC
        LDA Object_frame,x
        AND #%11000111
        ORA tempC
        STA Object_frame,x
        
        TXA
        STA tempA
        
        DoObjectAction tempA, tempB
    ;    ;arg0 = what object?
        ;arg1 = what step behavior?
    RTS
;;; 06 = Destroy Me
destroyMe_action:
    DestroyObject
    RTS
;;; 07 = Go To Warp
goToWarp_action:
    WarpToScreen warpToMap, warpToScreen, #$01
    RTS
;;; 08 = Show Message (1)
show_message_action

    RTS
;;; 09 = Go To Continue
goToContinue_action:
    LDA continueMap
    STA warpMap
    
    LDA continueScreen
    STA currentNametable
    
    LDX player1_object
    STA Object_screen,x
    
    LDA #$02 ;; this is continue type warp.
    STA screenTransitionType ;; is of warp type

    
    LDA gameHandler
    ORA #%10000000
    STA gameHandler ;; this will set the next game loop to update the screen.
    ChangeActionStep player1_object, #$00
    LDX player1_object
    LDA #$00000000
    STA Object_direction,x
    RTS
;;; 10 = Restart Screen
restartScreen_action:
    LDA #$02
    STA screenTransitionType
    LDA gameHandler
    ORA #%10000000
    STA gameHandler ;; this will set the next game loop to update the screen.
    ChangeActionStep player1_object, #$00
    LDX player1_object
    LDA #$00000000
    STA Object_direction,x
    RTS
;;; 11 = Restart Game
restartGame_action:
    JMP RESET
    RTS
;;; 12 = User 0
userEnd0_action:

    RTS
;;; 13 = User 1
userEnd1_action:

    RTS

    
EndAnimAndActions_Lo:
    .db #<end_loop_action, #<advance_action, #<repeat_action, #<goToFirst_action, #<goToLast_action, #<goToPrev_action, #<destroyMe_action, #<goToWarp_action
    .db #<show_message_action, #<goToContinue_action, #<restartScreen_action, #<restartGame_action, #<userEnd0_action, #<userEnd1_action
    
EndAnimAndActions_Hi:
    .db #>end_loop_action, #>advance_action, #>repeat_action, #>goToFirst_action, #>goToLast_action, #>goToPrev_action, #>destroyMe_action, #>goToWarp_action
    .db #>show_message_action, #>goToContinue_action, #>restartScreen_action, #>restartGame_action, #>userEnd0_action, #>userEnd1_action

I don't know where exactly I should add the new code or what the new code should say. You said to add it to the goToContinue section, but is there a specific line there to put it in? I also can't find where the script is pathed to in the "script settings". I've been making copies of the scripts and using different versions so I still have to default scripts for any future games but I don't know where to add the pathing for this new copy of the script. I'm sorry if I'm not super great at explaining things, help would be much appreciated. :)
 

BITVADER

Member
Overwrite "TimerEndScripts.asm" with the following content.
*Please make a backup just in case
;;; 00 = Loop
end_loop_action:

RTS
;;; 01 = Advance
advance_action:
LDA Object_frame,x
LSR
LSR
LSR
AND #%00000111
CLC
ADC #$01
AND #%00000111
STA tempB
;STA tempD ;; the action frame that was assigned during create macro.
;;;; object behavior tables are with the lut table.
;;;; the lut table is in bank 1C.
; SwitchBank #$1C
; ;;; Then, get the behavior for that object on that frame number.
; LDY Object_type,x
; LDA ObjectBehaviorTableLo,y
; STA pointer
; LDA ObjectBehaviorTableHi,y
; STA pointer+1
; LDY tempD
; LDA (pointer),y
; AND #%00001111
; STA tempB
; ReturnBank
LDA tempB
ASL
ASL
ASL
STA tempC
LDA Object_frame,x
AND #%11000111
ORA tempC
STA Object_frame,x

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 02 = Repeat
repeat_action:
LDA Object_frame,x
LSR
LSR
LSR
AND #%00000111
STA tempB

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 03 = Go To First
goToFirst_action:

LDA #$00
STA tempB
;;;; HURT END
LDA Object_frame,x
AND #%00111000
CMP #%00111000
BNE +notHurtFrame
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 Object_direction,x
AND #%00001111
STA Object_direction,x
;;;;;;;;;;;;;;;;;;;;
+notHurtFrame

LDA Object_frame,x
AND #%11000111
STA Object_frame,x


TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; turn off move towards point if current action is 7.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RTS
;;; 04 = Go To Last
goToLast_action:
LDA #$07
STA tempB


LDA Object_frame,x
ora #%00111000
STA Object_frame,x

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 05 = Go To Previous
goToPrev_action:
LDA Object_frame,x
LDA Object_frame,x
LSR
LSR
LSR
AND #%00000111
SEC
SBC #$01
AND #%00000111
STA tempB ;; the action frame that was assigned during create macro.
;;;; object behavior tables are with the lut table.
;;;; the lut table is in bank 1C.
ASL
ASL
ASL
STA tempC
LDA Object_frame,x
AND #%11000111
ORA tempC
STA Object_frame,x

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 06 = Destroy Me
destroyMe_action:
DestroyObject
RTS
;;; 07 = Go To Warp
goToWarp_action:
WarpToScreen warpToMap, warpToScreen, #$01
RTS
;;; 08 = Show Message (1)
show_message_action

RTS
;;; 09 = Go To Continue
goToContinue_action:
LDA continueMap
STA warpMap

LDA continueScreen
STA currentNametable

LDX player1_object
STA Object_screen,x

LDA #$02 ;; this is continue type warp.
STA screenTransitionType ;; is of warp type


LDA gameHandler
ORA #%10000000
STA gameHandler ;; this will set the next game loop to update the screen.
ChangeActionStep player1_object, #$00
LDX player1_object
LDA #$00000000
STA Object_direction,x
;;;;GameOverSequence
LDA myLives ;;Is myLives zero?
BNE +notGameover ;;still not zero
WarpToScreen warpToMap, #$7D, #$01 ;;setting screenposition
+notGameover
;;;;GameOverSequence END
RTS
;;; 10 = Restart Screen
restartScreen_action:
LDA #$02
STA screenTransitionType
LDA gameHandler
ORA #%10000000
STA gameHandler ;; this will set the next game loop to update the screen.
ChangeActionStep player1_object, #$00
LDX player1_object
LDA #$00000000
STA Object_direction,x
RTS
;;; 11 = Restart Game
restartGame_action:
JMP RESET
RTS
;;; 12 = User 0
userEnd0_action:

RTS
;;; 13 = User 1
userEnd1_action:

RTS


EndAnimAndActions_Lo:
.db #<end_loop_action, #<advance_action, #<repeat_action, #<goToFirst_action, #<goToLast_action, #<goToPrev_action, #<destroyMe_action, #<goToWarp_action
.db #<show_message_action, #<goToContinue_action, #<restartScreen_action, #<restartGame_action, #<userEnd0_action, #<userEnd1_action

EndAnimAndActions_Hi:
.db #>end_loop_action, #>advance_action, #>repeat_action, #>goToFirst_action, #>goToLast_action, #>goToPrev_action, #>destroyMe_action, #>goToWarp_action
.db #>show_message_action, #>goToContinue_action, #>restartScreen_action, #>restartGame_action, #>userEnd0_action, #>userEnd1_action
Add 6 lines of code below line 180.
 
Hi, sorry for the delay in my reply. So I made a copy of the script and then copy and pasted your code onto the duplicate "TimerEndScripts.asm" But it still just resets my game upon game over.

I tried to add the script into the "SubRoutines" section in my script settings, with the define being filled in with "SCR_TIMER_END_SCRIPTS".
TimerEndScriptDefinition.png
Included is a screenshot of my script setting screen. I included this newest script at the bottom of the "SubRoutines" section. The blurred part is just the name of my game which I plan to keep secret for now.

I also included the current version of the script in case there are some errors I made, perhaps with formatting the script.

Code:
;;; 00 = Loop
end_loop_action:

RTS
;;; 01 = Advance
advance_action:
LDA Object_frame,x
LSR
LSR
LSR
AND #%00000111
CLC
ADC #$01
AND #%00000111
STA tempB
;STA tempD ;; the action frame that was assigned during create macro.
;;;; object behavior tables are with the lut table.
;;;; the lut table is in bank 1C.
; SwitchBank #$1C
; ;;; Then, get the behavior for that object on that frame number.
; LDY Object_type,x
; LDA ObjectBehaviorTableLo,y
; STA pointer
; LDA ObjectBehaviorTableHi,y
; STA pointer+1
; LDY tempD
; LDA (pointer),y
; AND #%00001111
; STA tempB
; ReturnBank
LDA tempB
ASL
ASL
ASL
STA tempC
LDA Object_frame,x
AND #%11000111
ORA tempC
STA Object_frame,x

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 02 = Repeat
repeat_action:
LDA Object_frame,x
LSR
LSR
LSR
AND #%00000111
STA tempB

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 03 = Go To First
goToFirst_action:

LDA #$00
STA tempB
;;;; HURT END
LDA Object_frame,x
AND #%00111000
CMP #%00111000
BNE +notHurtFrame
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 Object_direction,x
AND #%00001111
STA Object_direction,x
;;;;;;;;;;;;;;;;;;;;
+notHurtFrame

LDA Object_frame,x
AND #%11000111
STA Object_frame,x


TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; turn off move towards point if current action is 7.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RTS
;;; 04 = Go To Last
goToLast_action:
LDA #$07
STA tempB


LDA Object_frame,x
ora #%00111000
STA Object_frame,x

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 05 = Go To Previous
goToPrev_action:
LDA Object_frame,x
LDA Object_frame,x
LSR
LSR
LSR
AND #%00000111
SEC
SBC #$01
AND #%00000111
STA tempB ;; the action frame that was assigned during create macro.
;;;; object behavior tables are with the lut table.
;;;; the lut table is in bank 1C.
ASL
ASL
ASL
STA tempC
LDA Object_frame,x
AND #%11000111
ORA tempC
STA Object_frame,x

TXA
STA tempA

DoObjectAction tempA, tempB
; ;arg0 = what object?
;arg1 = what step behavior?
RTS
;;; 06 = Destroy Me
destroyMe_action:
DestroyObject
RTS
;;; 07 = Go To Warp
goToWarp_action:
WarpToScreen warpToMap, warpToScreen, #$01
RTS
;;; 08 = Show Message (1)
show_message_action

RTS
;;; 09 = Go To Continue
goToContinue_action:
LDA continueMap
STA warpMap

LDA continueScreen
STA currentNametable

LDX player1_object
STA Object_screen,x

LDA #$02 ;; this is continue type warp.
STA screenTransitionType ;; is of warp type


LDA gameHandler
ORA #%10000000
STA gameHandler ;; this will set the next game loop to update the screen.
ChangeActionStep player1_object, #$00
LDX player1_object
LDA #$00000000
STA Object_direction,x
EndAnimAndActions_Lo:
.db #<end_loop_action, #<advance_action, #<repeat_action, #<goToFirst_action, #<goToLast_action, #<goToPrev_action, #<destroyMe_action, #<goToWarp_action
.db #<show_message_action, #<goToContinue_action, #<restartScreen_action, #<restartGame_action, #<userEnd0_action, #<userEnd1_action

EndAnimAndActions_Hi:
.db #>end_loop_action, #>advance_action, #>repeat_action, #>goToFirst_action, #>goToLast_action, #>goToPrev_action, #>destroyMe_action, #>goToWarp_action
.db #>show_message_action, #>goToContinue_action, #>restartScreen_action, #>restartGame_action, #>userEnd0_action, #>userEnd1_action
;;;;GameOverSequence
LDA myLives ;;Is myLives zero?
BNE +notGameover ;;still not zero
    WarpToScreen warpToMap, #$7D, #$01 ;;setting screenposition
    +notGameover
;;;;GameOverSequence END
    RTS
;;; 10 = Restart Screen
restartScreen_action:
    LDA #$02
    STA screenTransitionType
    LDA gameHandler
    ORA #%10000000
    STA gameHandler ;; this will set the next game loop to update the screen.
    ChangeActionStep player1_object, #$00
    LDX player1_object
    LDA #$00000000
    STA Object_direction,x
    RTS
;;; 11 = Restart Game
restartGame_action:
    JMP RESET
    RTS
;;; 12 = User 0
userEnd0_action:

RTS
;;; 13 = User 1
userEnd1_action:

RTS
 

BITVADER

Member
I think it's probably jumping to the reset code before the TimerEndScripts, but I don't know which version or which game it's based on, so it's hard to speculate.
 

Peter Schmitz

Active member
W

; 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

[DELETE JMP to GameOver]

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[/CODE]

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?
I guess when you remove the Reset and jmp to GameOver part - it should take you to the Game Over Screen
 
When I comment out the JMP RESET part in the code, I no longer run out of lives. I'm using NES maker 4.5.9 and working with the arcade platformer module. This is what I have for the code currently.

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
    ChangeActionStep player1_object, #$07
    LDA Object_direction,x
    AND #%00001111
    STA Object_direction,x
    GetActionStep temp
    CMP #$07
    BNE +continueHurtPlayer
        JMP +skipHurt
    +continueHurtPlayer
    PlaySound #sfx_Death
    Dec myLives
    LDA myLives
    BNE myLivesNotZero
        WarpToScreen #$0E, #$07, #$00
            ;JMP RESET ;; game over.
        ;;;; also could warp to game over screen here instead.
        
        
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

Is there something I'm missing or can't figure out?
 

dale_coop

Moderator
Staff member
You can check the small tutorial I made for a warp to GAME OVER screen, it could inspire you:
 
I'm getting closer now, it does send me to a new screen when I reach 0 lives. Problem is that it's an entirely blank screen instead of my game over screen. I set it to be x = 7 and y = 14 in the underworld. Here is the current code.
Code:
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
            JMP +doWarpToContinue
    +notMoreLives:
            ;; no more lives:
            LDA #$01             ;; 00: Overworld, 01: Underworld
            STA warpToMap

            LDA #$0E, #$07       ;; screen Y:15, X:15 (our GAME OVER screen)
            STA warpToScreen           

    +doWarpToContinue:   
        LDA myMaxHealth
        STA myHealth   
        WarpToScreen warpToMap, warpToScreen, #$02       
        ChangeActionStep player1_object, #$00
        LDX player1_object
        LDA #$00000000
        STA Object_direction,x
    RTS

Did I make a mistake with the code? Does it have a problem warping from a 16x16 tile screen to an 8x8 tile screen?
 

dale_coop

Moderator
Staff member
Almost there!
It should be:
Code:
LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)

Also make sure you set the warp in coords on your game overs screen (the location on thatscreen where the player will warp in).
 
It's still not working for me. I have my screen details set like this:

screen details.png

Could the problem be because I'm working with the arcade platformer module instead of the Metroidvania module as with your tutorial above? Is there some kind of incompatability? I've been using the default arcade module scripts for my game and my player dies in 1 hit only.
 
It's still not working for me. I have my screen details set like this:

View attachment 7638

Could the problem be because I'm working with the arcade platformer module instead of the Metroidvania module as with your tutorial above? Is there some kind of incompatability? I've been using the default arcade module scripts for my game and my player dies in 1 hit only.
The module isn't the issue, if your warping to the wrong screen I'd check what Hexadecimal number your putting in that Marco it starts with the Y coord followed by the X coord oh I see your just changing the warptoscreen var... the easier option would be:
WarpToScreen WarpToMap, #$YX, #$01
 
Last edited:
It's still not working. Here's the code in my "TimerEndScripts.asm":

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
            JMP +doWarpToContinue
    +notMoreLives:
            WarpToScreen WarpToMap, #$E7, #$01
            ;; no more lives:
            ;LDA #$01             ;; 00: Overworld, 01: Underworld
            ;STA warpToMap

            ;LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)
            ;STA warpToScreen           

    +doWarpToContinue:   
        LDA myMaxHealth
        STA myHealth   
        WarpToScreen warpToMap, warpToScreen, #$02       
        ChangeActionStep player1_object, #$00
        LDX player1_object
        LDA #$00000000
        STA Object_direction,x
    RTS

I made it so my player plays a death animation each death. Like so:

Player actions.png

Could there be something wrong with this part?
 
It's still not working. Here's the code in my "TimerEndScripts.asm":

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
            JMP +doWarpToContinue
    +notMoreLives:
            WarpToScreen WarpToMap, #$E7, #$01
            ;; no more lives:
            ;LDA #$01             ;; 00: Overworld, 01: Underworld
            ;STA warpToMap

            ;LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)
            ;STA warpToScreen         

    +doWarpToContinue: 
        LDA myMaxHealth
        STA myHealth 
        WarpToScreen warpToMap, warpToScreen, #$02     
        ChangeActionStep player1_object, #$00
        LDX player1_object
        LDA #$00000000
        STA Object_direction,x
    RTS

I made it so my player plays a death animation each death. Like so:

View attachment 7643

Could there be something wrong with this part?
try this:
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
JMP +doWarpToContinue
+notMoreLives:
LDA continueMap
STA warpToMap
WarpToScreen warpToMap, #$E7, #$01
;; no more lives:
;LDA #$01 ;; 00: Overworld, 01: Underworld
;STA warpToMap

;LDA #$E7 ;; screen Y:14, X:7 (our GAME OVER screen)
;STA warpToScreen
RTS
+doWarpToContinue:
; LDA myMaxHealth
; STA myHealth
;WarpToScreen warpToMap, warpToScreen, #$02
ChangeActionStep player1_object, #$00
LDX player1_object
LDA #$00000000
STA Object_direction,x
RTS
RTS is our true friend when finishing script stuff
 

dale_coop

Moderator
Staff member
It's still not working. Here's the code in my "TimerEndScripts.asm":

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
            JMP +doWarpToContinue
    +notMoreLives:
            WarpToScreen WarpToMap, #$E7, #$01
            ;; no more lives:
            ;LDA #$01             ;; 00: Overworld, 01: Underworld
            ;STA warpToMap

            ;LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)
            ;STA warpToScreen          

    +doWarpToContinue:  
        LDA myMaxHealth
        STA myHealth  
        WarpToScreen warpToMap, warpToScreen, #$02      
        ChangeActionStep player1_object, #$00
        LDX player1_object
        LDA #$00000000
        STA Object_direction,x
    RTS

I made it so my player plays a death animation each death. Like so:


Could there be something wrong with this part?

Your right, it might be the transition type of the warp.
Try that code for the 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:
            ;; no more lives:
            LDA #$01             ;; 00: Overworld, 01: Underworld
            STA warpToMap

            LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)
            STA warpToScreen           
            
            LDA #$01
            STA screenTransitionType
    +doWarpToContinue:   
        LDA myMaxHealth
        STA myHealth   
        WarpToScreen warpToMap, warpToScreen, screenTransitionType     
        ChangeActionStep player1_object, #$00
        LDX player1_object
        LDA #$00000000
        STA Object_direction,x
    RTS
 
So I copied the code exactly, first try from Lord Klump, then from Dale but both times it got me to same result. Then I tried to add in the RTS right above "+doWarpToContinue" That Lord Klump put in into the code from Dale, still same result of sending me to a blank screen.
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:
            ;; no more lives:
            LDA #$01             ;; 00: Overworld, 01: Underworld
            STA warpToMap

            LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)
            STA warpToScreen           
            
            LDA #$01
            STA screenTransitionType
    RTS
    +doWarpToContinue:   
        LDA myMaxHealth
        STA myHealth   
        WarpToScreen warpToMap, warpToScreen, screenTransitionType     
        ChangeActionStep player1_object, #$00
        LDX player1_object
        LDA #$00000000
        STA Object_direction,x
    RTS

Could I have an indentation error somewhere? Does my game over screen need to be in a certain game state? I have it set for the "Win Screen" which is third from the top. The screen I'm sent to still has the HUD whereas I set my game over screen to not show the HUD.
 

kevin81

Well-known member
I think something's up with this part of the code:

Code:
    +notMoreLives:
            ;; no more lives:
            LDA #$01             ;; 00: Overworld, 01: Underworld
            STA warpToMap

            LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)
            STA warpToScreen           
            
            LDA #$01
            STA screenTransitionType
    RTS

It sets the warp variables, but returns before actually telling the game to warp.
You could try to either remove the line that says RTS, or add a semicolon in front.
 

dale_coop

Moderator
Staff member
Exact, remove that "RTS", it stops there instead of keep executing the warp code.
(if you compare with my code, there his no RTS in mine ;))
 
I still can't get it to send me to the right screen.

Code:
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:
            ;; no more lives:
            LDA #$01             ;; 00: Overworld, 01: Underworld
            STA warpToMap

            LDA #$E7       ;; screen Y:14, X:7 (our GAME OVER screen)
            STA warpToScreen           
            
            LDA #$01
            STA screenTransitionType
    +doWarpToContinue:   
        LDA myMaxHealth
        STA myHealth   
        WarpToScreen warpToMap, warpToScreen, screenTransitionType     
        ChangeActionStep player1_object, #$00
        LDX player1_object
        LDA #$00000000
        STA Object_direction,x
    RTS

Could there be something in my HUD that's stopping it from warping properly? I have a game timer that uses this code:

Code:
LDA gameState
CMP #$00
BEQ +
JMP +isPausedGame
+
LDA isPaused            ;; load the variable to check if paused ;;
BEQ +
JMP +isPausedGame        ;; if it is paused go to isPausedGame ;;
+
;;; handle game timer.
    LDA gameTimerTicks
    CLC
    ADC #$01 ;; change this to how fast you want the timer to run.
    STA gameTimerTicks
    BCC +normaltime
    
        ;LDA ScreenFlags00
        ;AND #%11000000         ;; if "hide hud" is set.
        ;BNE +normaltime
    
    SubtractValue #$03, myTimer, #$01, #$00, #$00
    
    UpdateHudElement #$05
    LDA myTimer_1000
    BNE +notEnded
    LDA myTimer_100
    BNE +notEnded
    LDA myTimer_10
    BNE +notEnded
    LDA myTimer
    BNE +notEnded
    ;WarpToScreen warpToMap, warpToScreen, #$01
        JMP RESET
    +notEnded
    
+normaltime   
    LDA gameTimerLo
    ADC #$00
    STA gameTimerLo
    LDA gameTimerHi
    ADC #$00
    STA gameTimerHi
    
    LDA myTimer_100
    BNE +notEnded
    
+notEnded:

+isPausedGame

Or do I need to make variable, along the lines of "isGameOver" that is set to 1 once "myLives" is 0? the default for lives is 3 and it is possible to gain extra lives in my game.
 
Top Bottom