Game Over Special Screen

User avatar
dale_coop
Posts: 4206
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Game Over Special Screen

Post by dale_coop » Fri Mar 01, 2019 2:27 pm

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: Select all

;;; 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	
	
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
Raftronaut
Posts: 276
Joined: Mon Sep 03, 2018 4:47 pm

Re: Game Over Special Screen

Post by Raftronaut » Thu Mar 07, 2019 2:13 am

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!!!
Space Raft 2.0 Demo: [url] http://nesmakers.com/viewtopic.php?f=52&t=2867 [/url]

Chiptune: [url] https://soundcloud.com/user-634230995-350638590 [/url]
User avatar
dale_coop
Posts: 4206
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Game Over Special Screen

Post by dale_coop » Thu Mar 07, 2019 9:01 am

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: Select all

    ;; 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.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
Raftronaut
Posts: 276
Joined: Mon Sep 03, 2018 4:47 pm

Re: Game Over Special Screen

Post by Raftronaut » Thu Mar 07, 2019 4:10 pm

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?
Space Raft 2.0 Demo: [url] http://nesmakers.com/viewtopic.php?f=52&t=2867 [/url]

Chiptune: [url] https://soundcloud.com/user-634230995-350638590 [/url]
User avatar
dale_coop
Posts: 4206
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Game Over Special Screen

Post by dale_coop » Thu Mar 07, 2019 4:35 pm

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.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
Raftronaut
Posts: 276
Joined: Mon Sep 03, 2018 4:47 pm

Re: Game Over Special Screen

Post by Raftronaut » Thu Mar 07, 2019 6:15 pm

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!
Space Raft 2.0 Demo: [url] http://nesmakers.com/viewtopic.php?f=52&t=2867 [/url]

Chiptune: [url] https://soundcloud.com/user-634230995-350638590 [/url]
User avatar
dale_coop
Posts: 4206
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Game Over Special Screen

Post by dale_coop » Thu Mar 07, 2019 10:41 pm

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".
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
Raftronaut
Posts: 276
Joined: Mon Sep 03, 2018 4:47 pm

Re: Game Over Special Screen

Post by Raftronaut » Thu Mar 07, 2019 11:04 pm

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?
Space Raft 2.0 Demo: [url] http://nesmakers.com/viewtopic.php?f=52&t=2867 [/url]

Chiptune: [url] https://soundcloud.com/user-634230995-350638590 [/url]
User avatar
dale_coop
Posts: 4206
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Game Over Special Screen

Post by dale_coop » Fri Mar 08, 2019 7:26 am

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)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
Raftronaut
Posts: 276
Joined: Mon Sep 03, 2018 4:47 pm

Re: Game Over Special Screen

Post by Raftronaut » Fri Mar 08, 2019 4:46 pm

THAT WORKED!

thank you!
Space Raft 2.0 Demo: [url] http://nesmakers.com/viewtopic.php?f=52&t=2867 [/url]

Chiptune: [url] https://soundcloud.com/user-634230995-350638590 [/url]
Post Reply