Game Over Special Screen

Raftronaut

Member
However, i encountered another error. I got the game over script working, but my HUD is showing random tiles under my player lives variable. Is it possible the code isn't telling the game how many lives to award the newly spawned player? Is it possible to add this?
 

Raftronaut

Member
Yes,

Ok, after testing further I discovered that the code works correctly when I press the start button to reset. The HUD functions correctly after respawn.
What I had done is set a timer for an NPC monster to serve as some text on my Game Over screen. At the end of the timer I have the NPC performing a RESTART GAME action so that my GAME OVER JINGLE does not loop around and play again. This action resets my game, but my HUD Is glitching and showing random hud tiles instead of the numbers I used to keep count on player lives. I have screen shots to illustrate, but I am not sure how to post images on the forums yet.

The action for "reset game" in the monsters > Object Details> Actions ... where can I find this script? In My routines folder? I assume the script is missing an action step or something...
 

dale_coop

Moderator
Staff member
The action for "reset game" is set in the "Project Settings > Script Settings"... might be the "Action Anim End 7" element.
 

dale_coop

Moderator
Staff member
Edit one of my script in the first page, in order to fix a warp coords in the Game Over Screen (now it should use the warp in coords x,y set for the screen).
 

Raftronaut

Member
dale_coop said:
The action for "reset game" is set in the "Project Settings > Script Settings"... might be the "Action Anim End 7" element.

Dale, I am still having some trouble here, My hud updates to odd characters from the HUD chr file whenever I allow my game over screen NPCS to use the reset game action.

Can you help me understand where I can find this script and share it?restart.PNG
 

dale_coop

Moderator
Staff member
Hey Raftronaut,

Try using only one action:
the "end animation" action : executes the action when the animation (by "animation", I mean a sequence of animation frames) is done (you need to set the animation speed).
the "end action" action : executes the action when the timer is done (you need to set the Timer value).
Don't set both.

Then, which HUD updates makes problem? Health? Lives? Score? Would you share a screenshot (or a video)?
 

Raftronaut

Member
dale_coop said:
Hey Raftronaut,

Try using only one action:
the "end animation" action : executes the action when the animation (by "animation", I mean a sequence of animation frames) is done (you need to set the animation speed).
the "end action" action : executes the action when the timer is done (you need to set the Timer value).
Don't set both.

Then, which HUD updates makes problem? Health? Lives? Score? Would you share a screenshot (or a video)?

Ahhh, That is a really helpful explanation, I will correct this and recheck, if I am still having trouble I will post a video.


thank you, as always
 

Raftronaut

Member
dale_coop said:
Try using only one action:
the "end animation" action : executes the action when the animation (by "animation", I mean a sequence of animation frames) is done (you need to set the animation speed).
the "end action" action : executes the action when the timer is done (you need to set the Timer value).
Don't set both.

Then, which HUD updates makes problem? Health? Lives? Score? Would you share a screenshot (or a video)?

Hey Dale, I tried selecting only end animation on the NPC actions and still get the same results. game over reset.PNG

If I press the start button at the game over screen the game resets and the HUD works correctly. However, If I rely on the RESTART GAME end action, the HUD stops counting player lives and starts presenting odd tiles from the HUD CHR file. You can see here after my timer lapses on the game over screen, the HUD starts to misbehave after reset. https://youtu.be/hteWTcKM7GE

If I am correct, the 'end action' here is triggering a script I have under routines\basic\system\timerEndScripts\Timer_DoPlayerDeath.asm
Code:
	;;;; Handle loss of a life versus actual RESET death, simple.
	JSR LoseLife
I assume this is triggering a macro I have put in place, but i am a little lost on how to find it now.
 

dale_coop

Moderator
Staff member
I think your life is not set back to “3” when your game restart. So it goes below zero, the hud displays that (incorrect) value.

I am not on my pc today, I won’t be able to help you on that but...
A solution would be to make a simple script EndRimer_RESET script, with just a:

Code:
JMP RESET

And assign that reset script to the “end action” corresponding to “Reset Game”.

Else I am take a look tomorrow ;)
 

taluigi

New member
Just a very weird suggestion, can I just make a invisible sprite with a very slow animation. and when the animation ends in the "Game Over" screen (more like room lol), it restarts the game from the beginning?
 

dale_coop

Moderator
Staff member
Just place a monster object with no graphics on the screen... set his Action Step 0 to 'ignore gravity" and "end of action" to "restart game"... with a timer of "10" (or more if you want).
It should work.
 

taluigi

New member
...and it worked! I'm actually impressed that it does work naturally
Guess i'll use this trick more often, it's seem very helpful!
 

Raftronaut

Member
Could multiple warp points be utilized here to make an option to Continue or Reset?
Maybe re-purposing Mugi's stage selection method?

http://nesmakers.com/viewtopic.php?f=40&t=1788


I am not quite ready to implement a continue system yet in my game, but I definitely appreciate continues in old games to help make the gameplay more fair. Maybe a worthy topic of further discussion ;)
 

dale_coop

Moderator
Staff member
yeah, it would be doable...
Another possiblity, you could display:
(A) CONTINUE (B) RESET
and assign 2 different scripts to the corresponding buttons.
 

baardbi

Well-known member
Why isn't this working for me? I'm pretty sure I have done everything in the description here.

My character ends up in an undefined screen:

noseywrongscreen.png


My Game Over screen is screen number 254:

noseyoverworld.png


Here are some screenshots from NESmaker. Have I messed up again? :oops: :oops:

Game Over variable:

gameovervariable.png


Script Settings:

projectsettings2.png


The PlayerLoseLife.asm code:

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
 

baardbi

Well-known member
I see that I have written 254 instead of 255. So now I'm on the right screen, but my character is not deactivated, and can still be controlled on the Game Over screen.
 

dale_coop

Moderator
Staff member
yep, exact... the constant value should be 255.
(In my game over, I display my player... he's spawned between walls of solid blocks)

But if you want something, better ;)
- in every input scripts you would like to disable... add this code at the begining:
Code:
    ;; if on the GAME OVER screen
    LDA currentScreen
    CLC
    CMP #GAME_OVER_SCREEN
    BNE +
    RTS	;; skip the code
    +

- to make him disappear... modify the script assigned to the "Handle Sprite Drawing" element in the "Project Settings > Script Settings".
And after the "objectNotDeactivated:" line, add this block of code:
Code:
	;; hide player when screen-type 255
	CPX player1_object
	BNE +
	LDA currentScreen
	CLC
	CMP #GAME_OVER_SCREEN
	BNE +
	RTS
	+
 

baardbi

Well-known member
Amazing! :) :) It works perfectly. Thank you so much for all your help Dale. I really appreciate it. :)
 
Top Bottom