[4.5.6] Making special death screen

Lother

Member
I planning to do a special death screen that will work that way:

When my player enters in contact with a "monster" it will teleport him into a special cutscene screen (at X=14; Y=15) for one or two seconds then teleport the player back to the last checkpoint.

Problem is, I don't know how to do it when it comes to the code. I don't know how to pull off the teleportation to a specific screen. And since, I'm already using Warp Tiles to go from room to room, I can't set that to (14;15) in Screen info.

And the "GotoContinue" End Action, does it sends you to the last checkpoint ?
 

TolerantX

Active member
Here's an example of my handle hurt player script as you can see:


Code:
;;;; 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!;;

That section warps the player to the game over screen.

Code:
	TXA
	PHA
	LDA gameHandler
	AND #%10000000
	BEQ +canHurtPlayer
		JMP +skipHurt
+canHurtPlayer:
	TXA
	STA temp
	GetActionStep temp
	CMP #$07
	BNE +checkForVictory
		JMP +skipHurt
	+checkForVictory
		TXA
		STA temp
		GetActionStep temp
		CMP #$06
		BNE +canHurtPlayer
			JMP +skipHurt

	+canHurtPlayer	
	DEC myLives
	PlaySound #sfx_LOSE	
	UpdateHudElement #$01
	LDA myLives
	BNE +notZeroLives
		;;;zero lives
		;JMP RESET
;;;; 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


	+notZeroLives
		ChangeActionStep player1_object, #$07
			;; recoil
			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 xPrev
			; STA Object_x_hi,x
			; LDA yPrev
			; STA Object_y_hi,x
	
	
+skipHurt
	PLA
	TAX


on my game over screen i have an invisible monster that resets game when timer goes.
 

Pauldalyjr

Active member
Do you use checkpoints in your game? If yes you could steal that bit of code that impliments a checkpoint and place it in the code just before warping. Once you return from the special screen to the checkpoint it should be right where you saved. Only thing if you died before hitting another checkpoint it would start you back in that spot. You could also set up multiple checkpoint types if your good in the code, 1 for normal and one for the warps.
 

Lother

Member
To be more precise, my "game over" screen is at [14;15] in the Overworld and at each screen there is a checkpoint at the beginning of each room. When the timer is up, the player should be reset at the beginning of that room (i.e. the last checkpoint touched)
 

dale_coop

Moderator
Staff member
In your Handle Player Hurt script, instead of the line

Code:
	JMP RESET


You could try something like:

Code:
	;; JMP RESET
	
	LDA #$FE 			;; the screen number you want to warp to
	STA warpToScreen
	LDA #$00				;; the map to warp to (overworld/underworld)
	STA warpToMap

	WarpToScreen warpToMap, warpToScreen, #$02
	JMP +skipHurt
 

foovax

New member
@dale_coop. This code works as expected and takes me to a screen in the Overworld.

Can someone point me to a tutorial on how exactly the DeathScreen.bmp is used? I see it's loaded in special screen tilesets but I can't select it on tile layouts when building the screen.
 

foovax

New member
Pauldalyjr said:
Right after the warpToScreen line change that LDA #$00 to #$01, that will warp you to the underworld if that's what you needed.

That makes sense. However, my question is regarding the actual tile sets.

1) create new project select (create blank tilesets) and give it a folder_name
2) a folder is created NESmaker_4_5_6/GraphicAssets/folder_name/
3) there are some images in here named DeathScreen, Menu2Screen and MenuScreen, NPCScreen, RegisterScreen,ShopScreen,StartScreen,WinScreen

I'm not clear on how these larger 128x128 BMP images are used:

Called and referenced in ASM as screens by themselves?

OR

Is there a way to configure "Project Settings" to allow them to be available in [Project > Overworld > Tile Layout > Tileset Layout] combo box?

Currently all Tileset Layout options only offer Main, Screen & Path Tilesets.

Thanks!
 

CutterCross

Active member
foovax said:
That makes sense. However, my question is regarding the actual tile sets.

1) create new project select (create blank tilesets) and give it a folder_name
2) a folder is created NESmaker_4_5_6/GraphicAssets/folder_name/
3) there are some images in here named DeathScreen, Menu2Screen and MenuScreen, NPCScreen, RegisterScreen,ShopScreen,StartScreen,WinScreen

I'm not clear on how these larger 128x128 BMP images are used:

Called and referenced in ASM as screens by themselves?

OR

Is there a way to configure "Project Settings" to allow them to be available in [Project > Overworld > Tile Layout > Tileset Layout] combo box?

Currently all Tileset Layout options only offer Main, Screen & Path Tilesets.

Thanks!

Those 128x128 BMPs are holdovers from previous versions of the tool. Nothing in 4.5.6's default codebase includes the CHRs the tool spits out from those BMPs. That isn't to say you can't go into NESmaker's CHR load routines and create a system to load those CHRs (given you've included them in a bank), but depending on your knowledge of assembly language and NESmaker's codebase that may be out of reach and impractical at the moment.

Otherwise, you can just make your screens out of combinations of tilesets in the Tileset Layout window on the screen painter, which is the far more UI-friendly option.
 

dale_coop

Moderator
Staff member
Make your "Game Over" screen, exactly like Joe did the "Start Screen" or the "Win Screen" in the tutorials videos:
https://www.thenew8bitheroes.com/learn
(check the Maze "intermediate" one)
 

The_Siege

New member
Same deal here. I know some people use a program to help resize tilesets. I have been using PAINT and then fixing and redrawing the bad areas. the 128x128 tilesets are 8x8 screens, but the BckCHR screens are 6x6 So if you do what I just did and make you screen too large you will have to resize it to fit TWO BCKCHR screens. ultimately I had to turn my screen into a 96x96 screen to fit the two BCKCHR screens with the correct aspect ratio. Anyone have a program that allows you to resize without having to redraw and fix bad pixels? ALSO can someone tell me what GameStates 3-7 are? Where can I find all the monster bits and screen flag information? I have no idea what any of that stuff does .
 

dale_coop

Moderator
Staff member
I use paint.net...
For the resize, I set it to use the "Nearest Neighbor".

GameStates 3-7 can be used for anything you want! If you want the GameState 3 to be for "cutscene" or "intro"... or your "game over" screen.
Monster Bits... I think this data is not exported by the tool (UI).
Screen Flags bit are stored in "ScreenFlags00" and "ScreenFlags01".
 

Arctic Blizzard

New member
In your Handle Player Hurt script, instead of the line

Code:
    JMP RESET


You could try something like:

Code:
    ;; JMP RESET
   
    LDA #$FE             ;; the screen number you want to warp to
    STA warpToScreen
    LDA #$00                ;; the map to warp to (overworld/underworld)
    STA warpToMap

    WarpToScreen warpToMap, warpToScreen, #$02
    JMP +skipHurt
Thanks for posting this dale_coop. Works perfect. Once again. You saved the day! Simple easy code.
 
In your Handle Player Hurt script, instead of the line

Code:
    JMP RESET


You could try something like:

Code:
    ;; JMP RESET
  
    LDA #$FE             ;; the screen number you want to warp to
    STA warpToScreen
    LDA #$00                ;; the map to warp to (overworld/underworld)
    STA warpToMap

    WarpToScreen warpToMap, warpToScreen, #$02
    JMP +skipHurt

This is the last piece I am stuck on with my first game. I have changed the Handle Player Hurt, but the game isn't loading due to an error with what I've done in here:
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:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;; 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
        
        CountObjects #%00001000
            BNE +notZeroCount
                LDA scrollByte
                ORA #%00000010
                STA scrollByte
                ;;; if there are no more monsters left, we want to disable
                ;;; the edge check for scrolling.
                LDA ScreenFlags00
                AND #%11101111
                STA ScreenFlags00
            +notZeroCount
    PLA
    TAX

     ;; Do a hop
     LDA #$FC
     STA Object_v_speed_hi,x
    

     JMP +skipHurt

    
+doHurtPlayer   

    Dec myLives
    LDA myLives
    BNE myLivesNotZero
       ;; JMP RESET
    
       LDA #$04            ;; the screen number you want to warp to
    STA warpToScreen
    LDA #$00                ;; the map to warp to (overworld/underworld)
    STA warpToMap

    WarpToScreen warpToMap, warpToScreen, #$02
    JMP +skipHurt

Any advice on what I should edit in order for this to warp me to my Game Over screen when I die? My only thought is that the 'warp to' screen needs to be something different since it's an 8x8 pixel screen (after following start screen tutorial for text adding). 4,0 is my goal location (reversed in code to Y,X variable);

full overworl.PNG
 
Your hurtPlayer_PlatformBase.asm is missing a :
Code:
+skipHurt:
...at the end.
Ok, so here's where we are at now...

I previously had a JMP+skipHurt in line 58. I left that and added what you provided in line 59. I went to boot up and got a new error message in regards to line 49.
Capture.PNGCapture2.PNGCapture3.PNG

Thanks again for the help. I know it's something small I'm missing. Just can't figure out how to make it work.
 
Very puzzled now. So I added that in (full code below). It worked initially, but upon hitting my Game Over screen and resetting to try again, it has a new issue.
Now, when I hit a monster/hurt, I warp to the next line of tiles (ex. Level 1 A, Level 1B, Level 2A) After losing the 3rd life, it resets to title screen. It no longer warps to Game Over screen as it did the first try.

At least it is booting up at this point. So, we are in a better spot. :)
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:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;; 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
        
        CountObjects #%00001000
            BNE +notZeroCount
                LDA scrollByte
                ORA #%00000010
                STA scrollByte
                ;;; if there are no more monsters left, we want to disable
                ;;; the edge check for scrolling.
                LDA ScreenFlags00
                AND #%11101111
                STA ScreenFlags00
            +notZeroCount
    PLA
    TAX

     ;; Do a hop
     LDA #$FC
     STA Object_v_speed_hi,x
    

     JMP +skipHurt

    
+doHurtPlayer   

    Dec myLives
    LDA myLives
    BNE myLivesNotZero
       ;; JMP RESET
    
       LDA #$04            ;; the screen number you want to warp to
    STA warpToScreen
    myLivesNotZero:
    LDA #$00                ;; the map to warp to (overworld/underworld)
    STA warpToMap

    WarpToScreen warpToMap, warpToScreen, #$02
    JMP +skipHurt
    +skipHurt:
 
Top Bottom