Game Over Special Screen

dale_coop

Moderator
Staff member
Check the lines where there is an error (you see that it's in the gameover_inputs.asm script line "2" the and the error is "unknown label"... an operation is using a label that is not known by the compilator...)

Note/// In the 4.5, the "currentScreen" doesn't exist, it has been replace by "camScreen"
 

mouse spirit

Well-known member
currentScreen
#GAME_OVER_SCREEN

Those are what needs changed or fixed. Did you make constant named #GAME_OVER_SCREEN?
And does 4.5 use currentScreen?
 

PasseGaming

Active member
okay, so I fixed the script by changing the one lable to camScreen and removed CMP #GAME_OVER_SCREEN. game compiles fine now but it still doesn't take the player to the game over screen.

I named a game-state; GAME_OVER_SCREEN
 

PasseGaming

Active member
... hmph, I think I got it kind of working now but it didn't take the player object to the game-over screen like it was supposed too. Supposed to take me to underworld x15 y15 like the script called for.

Managed to fix that, now the only issue I have is that the input on the game over screen doesn't seem to do anything.
 

mouse spirit

Well-known member
Is your input labeled for the right gamestate? like maingame, startscreen.
Like when you make the input,it should ask for which state.Make sure its for the same
state that that screen is.
 

PasseGaming

Active member
Still does some weird stuff but I'll hammer that out. It definitely doesn't like warping into a advanced screen.
 

PasseGaming

Active member
Okay, I managed to get the game over screen to work.... until I added checkpoints into the game. Here is the checkpoint script and my game over script. Does anyone know what I need to do to get the two to work together?

adventure checkpoint script
Code:
;;; sets a new player continue checkpoint.
	CPX player1_object
	BNE +skip
	LDA currentNametable
	STA continueScreen
	LDA Object_x_hi,x
	STA continueX
	LDA Object_y_hi,x
	STA continueY
	
+skip

game over screen script
Code:
	;;;;;;;;;;;;;;;;;; Presumes there is a variable called myLives defined in user variables.
	;;;;;;;;;;;;;;;;;; You could also create your own variable for this.
	LDA gameHandler
	AND #%10000000
	BEQ +canHurtPlayer
		JMP +skipHurt
+canHurtPlayer:

	Dec myLives
	LDA myLives
	BNE myLivesNotZero
		;JMP RESET ;; game over.
		;;;; also could warp to game over screen here instead.
		
	WarpToScreen #$01, #$FF, #$01  ;;This is warp to UNDERWORLD, LAST SCREEN this is for me because 8x8 , #$01 is normal warp;;
	;; arg0 = warp to map.  0= map1.  1= map2.
	;; arg1 = screen to warp to. use mouse to find coordinates = #$yx use hex convertor. 
	;; arg2 = screen transition type - most likely use 1 here.
		;; 1 = warp, where it observes the warp in position for the player.
	;;Don't Forget to set WARP IN COORDINATES ON YOUR MAP!;;

	JMP +skipHurt

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
	sta camX_lo
	
	
	
	
	LDA updateScreenData
	AND #%11111011
	STA updateScreenData
	LDA scrollByte
	AND #%00111110
	ORA #%00000010
	STA scrollByte
	LDA #$00
	STA scrollOffsetCounter
	
	LDA gameHandler
	ORA #%10000000
	STA gameHandler ;; this will set the next game loop to update the screen.
	
	LDA #$05 
	STA bossHealth ;; resets boss health for this level.

+skipHurt
 

Logana

Well-known member
It should work there is nothing that over laps, maybe it hast to do with the continue screen part of the code but I have no clue I don’t code
 

Jonny

Well-known member
Ah cool, I love that chronicleroflegends. Quite funny.

I'd actually been thinking about how much I like the intros for games like Monkey Island 2 and Simon The Sorcerer, with a similar idea using the sprites on a blank background.

Theres also a Bones demo on the BBC Micro from decades ago that I like. I'm tying to implement some of those ideas in my cut scenes but in a simpler way but keeping the comedy factor.

I never thought of saying "game over" in different words. Inspirational as usual Dale.
 

PasseGaming

Active member
Okay, could someone take a look at this script I have here. I am trying this again as I'd really like a game over screen, I feel you game isn't complete without one. I modified the original script slightly, because I don't want a continue screen. Just the game over screen. I looked at this script time and again and I quite can't figure out what the issue is. The game complies just fine, loads up and plays fine as well. Issue is when you die for the first time, the game jumps to the game over screen, then restarts you at the beginning of the stage with infinite lives. I have no idea what the issue is, lol. It may just be as simple as I have it in the wrong spot, but I can't tell.

Code:
	LDA gameHandler
	AND #%10000000
	BEQ +canHurtPlayer
		JMP +skipHurt
+canHurtPlayer:

	Dec myLives
	LDA myLives
	BNE myLivesNotZero
	    ;JMP RESET ;; game over.
	    ;;;; also could warp to game over screen here instead. ;;
	
	WarpToScreen #$01, #$E7, #$01  ;;This is warp to UNDERWORLD, LAST SCREEN this is for me because 8x8 , #$01 is normal warp;;
	;; arg0 = warp to map.  0= map1.  1= map2.
	;; arg1 = screen to warp to. use mouse to find coordinates = #$yx use hex convertor. 
	;; arg2 = screen transition type - most likely use 1 here.
		;; 1 = warp, where it observes the warp in position for the player.
	;;Don't Forget to set WARP IN COORDINATES ON YOUR MAP!;;

	JMP +skipHurt
+skipHurt
+myLivesNotZero	
	ChangeActionStep player1_object, #$07
	PlaySound #sfx_BossDeath
+skipHurt
 

dale_coop

Moderator
Staff member
Remove the "+skipHurt" line in the middle of your script (the one just before your "+myLivesNotZero")
I think it's your error ;)
 

PasseGaming

Active member
Welp, after several months of fiddling with this script I've finally managed to get a working game over screen. I am beyond happy, thank you again Dale. You are absolutely fantastic, however I do have one more quick question for ya. Now, while on the game over screen, I had the input set to the below script to reset the game. Simple enough but for whatever reason it doesn't do anything. I have it set to Game Over and Press A or B buttons but nothing happens. Does anyone have a idea of what is the matter? Just want to reset the game from here.

Code:
   ;; if on the GAME OVER screen
    LDA camScreen
    CLC
    CMP #GAME_OVER_SCREEN
    BNE +
    JMP RESET
+
	RTS

Never mind, I found the stupid problem just by posting the code here. lol
 

puppydrum64

Active member
Hello!

Coming back to the forums for what may be a simple tutorial request. In most classic NES games, when a character has run out of lives, they are taken to a Game Over screen which might ask if the player would like to continue? The player could also just be sent back to the title screen. I'm hoping that at some point in the future there may be an expansion of the tutorial on Special Screens including "Game Over". I think that "Start Game" and "Win Game" are crucial as well but since we're limited to those in the user interface, perhaps we could gain some insight into creating additional special screens, if possible.

Tower of Turmoil included some cool cutscenes which I'm sure were tailored to that game but I wonder if there are parallels between creating cutscenes, and sending a player to the Game Over screen or WinGame screen. At least a tutorial on creating a screen like "Game Over" and implementing

Make your "Game Over" screen... for example here I used the 254th one:
2019-02-13-06-52-06.png


In "Project Settings > User Constants", create a new constants named "GAME_OVER_SCREEN", and give it the value of the screen you chose, here "254":
2019-02-13-06-47-12.png


Now, modify your PlayerLoseLife.asm script, like
This :
Code:
;;; do loss of life stuff here
    DEC myLives
    LDA myLives
    BNE gameNotOver
    ;;do gameover stuff here.  Warp to screen?  Show animation?  Just restart?
    ;JMP RESET
    LDA #GAME_OVER_SCREEN
    STA continueScreen
   
    LDA #$02
    STA temp1
    JMP isGameOver
   
gameNotOver:
    LDA #$04
    STA temp1
isGameOver:
    ;;;;;
    ;;; do warp to continue screen stuff here.
    LDA #$00
    STA newGameState
    LDA continueMap
    CLC
    ADC #$01
    STA temp
    GoToScreen continueScreen, temp, temp1   
    LDA #$00
    STA playerToSpawn
    ;LDX player1_object
    ;DeactivateCurrentObject   
    LDA #$01
    STA loadObjectFlag
   
    JSR DeactivateAllObjects

    LDA continuePositionX
    STA newX
    LDA continuePositionY
    STA newY   

    ;; player1 reset health:
    LDA #$03        ;;  <--- HERE reset with your Health value
    STA myHealth

And another things, here a script to RESET your game when you are on the Game Over screen:
Code:
    ;; if on the GAME OVER screen
    LDA currentScreen
    CLC
    CMP #GAME_OVER_SCREEN
    BNE +
    JMP RESET
+
    RTS
You can assign this script to any button you want to use to reset the game.
Sadly this doesn't seem to work anymore, NESMaker doesn't recognize the variable names as given. I didn't know what or how to define them so I just removed them from my code. This was my version of the code I attempted to use, but it didn't work. It took me to the completely wrong screen (after looking up demo.txt and the address in the Mesen memory viewer it was taking me to screen A6 instead of 0F, which is what my game over screen was set to.) So I copied my Game Over screen to A6 and it displays the wrong tileset. I'm guessing my game doesn't know to change tilesets when I tell it to warp? How do I accomplish this in a way that's compatible with 4.5.9?

Code:
    ;;;;;;;;;;;;;;;;;; Presumes there is a variable called myLives defined in user variables.
    ;;;;;;;;;;;;;;;;;; You could also create your own variable for this.

    LDA gameHandler
    AND #%10000000
    BEQ +canHurtPlayer
        JMP +skipHurt
+canHurtPlayer:

    DEC myLives
    LDA myLives
    BNE myLivesNotZero
        ;JMP RESET ;; game over.
        ;;;; also could warp to game over screen here instead.
    WarpToScreen #$00, #GAME_OVER_SCREEN, #$01
    JMP +skipHurt
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
    sta camX_lo
    
    
    
    
    LDA updateScreenData
    AND #%11111011
    STA updateScreenData
    LDA scrollByte
    AND #%00111110
    ORA #%00000010
    STA scrollByte
    LDA #$00
    STA scrollOffsetCounter
    
    LDA gameHandler
    ORA #%10000000
    STA gameHandler ;; this will set the next game loop to update the screen.
    
    LDA #$05 
    STA bossHealth ;; resets boss health for this level.

+skipHurt
 

puppydrum64

Active member
Okay, could someone take a look at this script I have here. I am trying this again as I'd really like a game over screen, I feel you game isn't complete without one. I modified the original script slightly, because I don't want a continue screen. Just the game over screen. I looked at this script time and again and I quite can't figure out what the issue is. The game complies just fine, loads up and plays fine as well. Issue is when you die for the first time, the game jumps to the game over screen, then restarts you at the beginning of the stage with infinite lives. I have no idea what the issue is, lol. It may just be as simple as I have it in the wrong spot, but I can't tell.

Code:
    LDA gameHandler
    AND #%10000000
    BEQ +canHurtPlayer
        JMP +skipHurt
+canHurtPlayer:

    Dec myLives
    LDA myLives
    BNE myLivesNotZero
        ;JMP RESET ;; game over.
        ;;;; also could warp to game over screen here instead. ;;
   
    WarpToScreen #$01, #$E7, #$01  ;;This is warp to UNDERWORLD, LAST SCREEN this is for me because 8x8 , #$01 is normal warp;;
    ;; arg0 = warp to map.  0= map1.  1= map2.
    ;; arg1 = screen to warp to. use mouse to find coordinates = #$yx use hex convertor.
    ;; arg2 = screen transition type - most likely use 1 here.
        ;; 1 = warp, where it observes the warp in position for the player.
    ;;Don't Forget to set WARP IN COORDINATES ON YOUR MAP!;;

    JMP +skipHurt
+skipHurt
+myLivesNotZero   
    ChangeActionStep player1_object, #$07
    PlaySound #sfx_BossDeath
+skipHurt
Sadly this does not work for me either. I get to the correct screen but it's using the tileset for the screen that the player came from. Music is correct though.
 
Top Bottom