baardbi said:Amazing! It works perfectly. Thank you so much for all your help Dale. I really appreciate it.
Glad it worked.
My pleasure, baardbi
And feel free to share your project in the WIP section
baardbi said:Amazing! It works perfectly. Thank you so much for all your help Dale. I really appreciate it.
;;;;;;;;;;;;;;;;;; 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, #$02, #$01 ;;test numbers to try to warp to screen 2 or 3 i dont care as long as it warps;;
;; arg0 = warp to map. 0= map1. 1= map2.
;; arg1 = screen to warp to.
;; arg2 = screen transition type - most likely use 1 here.
;; 1 = warp, where it observes the warp in position for the player.
myLivesNotZero:
LDA continueMap
STA warpMap
LDA continueScreen
STA currentNametable
LDX player1_object
STA Object_screen,x
LDA #$02 ;; this is continue type warp.
STA screenTransitionType ;; is of warp type
LDA gameHandler
ORA #%10000000
STA gameHandler ;; this will set the next game loop to update the screen.
+skipHurt
JMP +skipHurt
WarpToScreen #$00, #$02, #$01 ;;test numbers to try to warp to screen 2 or 3 i dont care as long as it warps;;
WarpToScreen #$00, #GAME_OVER_SCREEN, #$01
;;;;;;;;;;;;;;;;;; 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, #$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
myLivesNotZero:
LDA continueMap
STA warpMap
LDA continueScreen
STA currentNametable
LDX player1_object
STA Object_screen,x
LDA #$02 ;; this is continue type warp.
STA screenTransitionType ;; is of warp type
LDA gameHandler
ORA #%10000000
STA gameHandler ;; this will set the next game loop to update the screen.
+skipHurt
;;; Reset with Lives that uses can hurt player type script.
;; check to see if object colliding is a player.
;; if not, do not reset.
CPX player1_object
BNE dontDoTileReset
;;JMP RESET
JSR +canHurtPlayer ;;; this is safer than just using a JMP command here ;;
dontDoTileReset:
;;;; DRAW SPRITE ZERO FOR SPRITE ZERO HIT
;; if "Hide Hud" screen flag is set, skip the sprite drawing:
LDA screenFlags
AND #%00000001
BNE +
chronicleroflegends said:Thanks, I did it and even though its simple, I think it looks really good.
dale_coop said:Your game crashes because by hiding your hud, your sprite 0 right not be able to have a collision with a non transparent pixel.
You can fix that issue... Modify the script assigned to the "Handle Sprite Pre-Draw" element in your "Project Settings > Script Settings":
And, before the line (around line 38):
Code:;;;; DRAW SPRITE ZERO FOR SPRITE ZERO HIT
Add this code:
Code:;; if "Hide Hud" screen flag is set, skip the sprite drawing: LDA screenFlags AND #%00000001 BNE +
Like this:
Voilà, now, it should not freeze your game anymore.
Jonny said:Do you have a pic of what you ended up with? I went though a similar process for my start screen. I started with something far too complex, spent ages with it, then completely redid it.
I ended up with only these tiles... (and some existing monster tiles). I've tried to make it so I can re-use the tileset to write other words, like game over for example.
TolerantX said:Thank you! This helped a lot. Okay NESmakers! so here's how it works... the code itself has a lot commented to explain things out simply.
you don't need to create any variable because you need to know where you're setting your warp and hex convert or just use the coordinates I provided. (*If you are okay with using 8x8 on a Game Over Screen AND your last screen on the UNDERWORLD)
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, #$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 myLivesNotZero: LDA continueMap STA warpMap LDA continueScreen STA currentNametable LDX player1_object STA Object_screen,x LDA #$02 ;; this is continue type warp. STA screenTransitionType ;; is of warp type LDA gameHandler ORA #%10000000 STA gameHandler ;; this will set the next game loop to update the screen. +skipHurt
works for you? Please make sure to read the commented out lines for more help.
Cool? Alright moving on to another cool thing you can do with this!!!!
See how you just wrote a script that when you die warps you?
this is the playerhurtreset tile made to actually account for all lives too!
Code:;;; Reset with Lives that uses can hurt player type script. ;; check to see if object colliding is a player. ;; if not, do not reset. CPX player1_object BNE dontDoTileReset ;;JMP RESET JSR +canHurtPlayer ;;; this is safer than just using a JMP command here ;; dontDoTileReset:
Now for OTHER games you may want to use myHealth and take damage or die instantly or you may want to have it play a death animation then after that warp you.... that would be different scripts, but related to this. Those can be written for those games at a later time. This is a simple solution for most people to use.
mouse spirit said:make it so the only input for that gamestate warps you to where you want to go and resets life and lives.
In a nutshell.
;; if on the GAME OVER screen
LDA currentScreen
CLC
CMP #GAME_OVER_SCREEN
BNE +
JMP RESET
+
RTS