DocNES
Member
I couldn't find past information on this, so I thought I'd share my code with future newbies like me.
-As always if you can improve on this, PLEASE post and I'll update.
Problem: Increasing Health, then hitting a Death Spike/etc would result in a Player respawn with -1 life, and the same increase in health.
Solution: Update to playerHurt_platform.asm to include reloading the health and setting it in this case to 3. (Me default). I feel like there is a better way to do this, since I'm checking the Player Object twice. I kept getting out of range error without the first two lines I added.
-As always if you can improve on this, PLEASE post and I'll update.
Problem: Increasing Health, then hitting a Death Spike/etc would result in a Player respawn with -1 life, and the same increase in health.
Solution: Update to playerHurt_platform.asm to include reloading the health and setting it in this case to 3. (Me default). I feel like there is a better way to do this, since I'm checking the Player Object twice. I kept getting out of range error without the first two lines I added.
;; Simple Reset
;; check to see if object colliding is a player.
;; if not, do not reset.
CPX player1_object
BNE dontDoTileReset
LDA Object_direction,x
AND #%00001111
STA Object_direction,x
Dec myLives
LDA myLives
BNE +myLivesNotZero
JMP RESET ;; game over.
;;;; also could warp to game over screen here instead.
+myLivesNotZero:
;;;;;;;;;;;;;;;; DocNes - Added to reset health on respawn
CPX player1_object
BNE dontDoTileReset
LDA myHealth
LDA #$03 ; Ammount to reset myHealth
STA myHealth
;;;;;;;;;;;;;;;;
LDA continueMap
STA warpMap
LDA continueX
STA newX
LDA continueY
STA newY
LDA continueScreen
STA warpToScreen
STA camScreen
WarpToScreen warpToMap, warpToScreen, #$02
dontDoTileReset: