TheRetroBro
Active member
I noticed dieing in the underworld warps me back to the associated tile from the overworld
Is there a fox for this?
Is there a fox for this?
It would help if you could post the hurt/death script. The warp map needs to be 1 in order to warp to the underworld. So you need to make sure in your death code, it is set up like this:I noticed dieing in the underworld warps me back to the associated tile from the overworld
Is there a fox for this?
LDA #1 ;;; Underworld
STA warpToMap
;;;;;;;;;;;;;;;;;; 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.
; Check if there's an enemy below (assuming enemies have a specific object type).
LDA Object_type, x
CMP #$06 ;; Adjust the object type accordingly.
BNE +doHurtPlayer ;; If the object below is not an enemy, proceed to hurting the player.
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
PlaySound #sfx_index_sfx_laser
Dec myLives
LDA myLives
BNE myLivesNotZero
JMP RESET
;; game over.
;;WarpToScreen #$0, #01, #$01;;;; also could warp to game over screen here instead.
myLivesNotZero:
LDA continueMap
STA warpMap
LDA continueX
STA newX
LDA continueY
STA newY
LDA continueScreen
STA warpToScreen
STA camScreen
WarpToScreen warpToMap, warpToScreen, #$02
+skipHurt
STA continueMap
ha yeah i had started my player in my underworld to test out the area and now realize this was the issue when dieing! oops lol slight oversite by me!When you die, you respawn at your previous checkpoint
Make sure you have a correcr checkpoint script and also that you placed a checkpoint tile at strategic places (usually the beginning of your levels).
Also, if you're not using checkpoints and you're starting your game from a screen on the underworld map, you need to modify the Initialization script.
Search for the "STA warpMap" line and AFTER that line add:
Code:STA continueMap