Game Over Special Screen

angelcrusher

New 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
 

dale_coop

Moderator
Staff member
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.
 

Mihoshi20

Member
dale_coop said:
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 PlayeLoseLife.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
	
gameNotOver:
	;;;;;
	;;; do warp to continue screen stuff here.
	LDA #$00
	STA newGameState
	LDA continueMap
	CLC
	ADC #$01
	STA temp
	GoToScreen continueScreen, temp, #$04	
	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.

Not bad, seems you came to about the same conclusion I did. Though the way I handled it was to put a warp to screen in HandlePlayerDaeath.asm after the PlaySound entry and then used an NPC on the gameover screen that has a reset game as it's end action so that the gameover screen stays displayed for about...mmm.. maybe 7 seconds efore automatically going to reset. I also wanted to do an autotext message also before resetting but still looking into getting the right message displayed.
 

dale_coop

Moderator
Staff member
Great, I might had a timer too on my GameOver screen (for when the player doesn't press START after all ;))
 
If I wanted to use one of my map screens as a fake special screen like this, do you have any advice on how to get large graphics onto a normal map screen?

I just want to make a black screen with a big 'GAME OVER', but I am having trouble.
I'm using the Shiro Nes Screen tool with my graphics program to make the text, and I can make it into a tileset with the tool. But it keeps turning out too large to fit in a normal tileset.

I guess I can make the 'Game Over' text smaller, but I feel like there should be some way to do this.
 

dale_coop

Moderator
Staff member
Glad you made it!
For bigger tileset, could be possible, but it would require deeper modifications of code puns might not be compatible with the NESMaker tool itself.
So sorry, currently, just try reducing your tiles to fit in your tileset ;)
 

dale_coop

Moderator
Staff member
I found the script had an issue (the location of warp in XY of the GameOver screen was not used... so your player could be warped in... in a incorrect place).

Here's a fixed version of this PlayerLoseLife_GameOver.asm script:
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
	JMP gameOver
	

gameNotOver:
	;;;;;
	;;; do warp to continue screen stuff here.
	LDA #$00
	STA newGameState
	LDA continueMap
	CLC
	ADC #$01
	STA temp
	GoToScreen continueScreen, temp, #$04	
	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	
	
	RTS
gameOver:
	;; warp to Game over:
	LDA #GAME_OVER_SCREEN
	STA warpToScreen
	
	LDA #$00
	STA newGameState
	LDA continueMap
	CLC
	ADC #$01
	STA temp
	GoToScreen warpToScreen, temp, #$02	
	LDA #$00
	STA playerToSpawn
	;LDX player1_object
	;DeactivateCurrentObject	
	LDA #$01
	STA loadObjectFlag
	
	JSR DeactivateAllObjects
 
	RTS
 

Raftronaut

Member
I am trying to get this game over screen to work, but I am a little confused on how to get the RESET script working. I have the game over screen working correctly already, but I am not sure what to do with the second step. Is this an input command I need to arrange for the game over screen? Where do I link the script to get it working? I am new to the scripting side and could use further explanation if possible. Also, a timer was mentioned , this would work as well, just uncertain how to achieve that. I am very excited to get this feature working in my game! thank you for posting!!!
 

dale_coop

Moderator
Staff member
In fact, with this tutorial we use a normal game screen that we disguise in a "GAME OVER" screen.
So the (special) RESET script:
Code:
    ;; if on the GAME OVER screen
    LDA currentScreen
    CLC
    CMP #GAME_OVER_SCREEN
    BNE +
    JMP RESET
+
	RTS
Will RESET the game ONLY if the current screen is the "Game Over" screen (it will check the current screen id and compare with the user constant value). If it's not the game over screen, it will do NOTHING.

Because the Game Over is in fact a normal game screen, in the "Input Editor", you have to set that script to target:"MainGame" "Press" START (for example) button.
 

Raftronaut

Member
OK, I am understanding the user constant, what I am still confused on is WHERE this special reset code should be added. Do I simply copy and paste it to the end of my PlayerLoseLife_GameOver.asm script? Or do I create a new input script assigned to the game over screen? If so, which folder are the input scripts kept in?
 

dale_coop

Moderator
Staff member
Just, make a new script, name for example "GameOver_RESET.asm" with the code I suggested.
Add this script in for your input, via "Scripts > Input Scripts" (in the NESMaker's hierarchy treeview), then in "Input Editor" you can assign it to your press button.
 

Raftronaut

Member
Ok Great

This scripting concept is beginning to make much more sense to me now.

Thank you for your explanation

Your patience for beginners is admirable!
 

dale_coop

Moderator
Staff member
Script you will use for input (pressing on button) need to be added in the project via the "Scripts > Input Scripts".
The scripts used for the physics, collisions with tiles or pickups, or objects events,.... are assigned in "Project Settings > Scripts Settings".
 

Raftronaut

Member
I should be able to figure this out from your previous explanation. I will give it a shot tonight and see if I can get it working.

One more question, I seem to be having trouble getting nesmaker to read my custom script files, I noticed when I create from scratch they are saved as TXT files and will not be recognized by nesmaker, only the existing scripts are shown as ASM text files and are recognized. The only way I have gotten my scripts to work is by DUPLICATING those scripts already labeled as ASM and erasing the code and replacing with my own. I understand that I simply need to format the text save file as ASM, but I cannot figure out how to format it as such. Is there something I am missing preventing me from saving these text files as ASM code?

I suppose my ASM file duplication/replacement is working, but there must be an easier way.. Any thoughts?
 

dale_coop

Moderator
Staff member
To save as ".ASM", when you are in the notepad and chose "Save..." you have a type of files dropdown list (at bottom right), select "all files (*.*)" and when you type the filename, type the full name with extension (for example: MyCustomScript.asm)
 
Top Bottom