TheRetroBro
Active member
Goal:
Player spawns and loads in 1 health point (this will essentially be a shield so the player can get hit once then all hits afterwards take a life) using variable "Health" This can increase by picking up a shield:
My Problem. P Layer loads in
will take 1 hit and do damage. Next hit will cause a loss of life (PERFECT THATS WHAT WE WANT)
HOWEVER>>>DUH DUH DUHDUH!!!!!
player somehow becomes invincible after this initial loop. Every Monster hit afterward just does damage and does not take a life: See my Code Below and linked video!
View: https://www.youtube.com/watch?v=6ibUosUHW3o
Player spawns and loads in 1 health point (this will essentially be a shield so the player can get hit once then all hits afterwards take a life) using variable "Health" This can increase by picking up a shield:
My Problem. P Layer loads in
will take 1 hit and do damage. Next hit will cause a loss of life (PERFECT THATS WHAT WE WANT)
HOWEVER>>>DUH DUH DUHDUH!!!!!
player somehow becomes invincible after this initial loop. Every Monster hit afterward just does damage and does not take a life: See my Code Below and linked video!
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 +docheckhealth
ChangeActionStep player1_object, #$07
JMP +skipHurt
+docheckhealth
LDA Health
DEC Health
CMP 0
BEQ +doHurtPlayer
ChangeActionStep player1_object, #$07
JMP +skipHurt
+doHurtPlayer
PlaySound #sfx_index_sfx_noteDead
Dec myLives
PlaySound #sfx_index_sfx_noteDead
LDA myLives
BNE myLivesNotZero
JMP RESET
;; game over.
WarpToScreen #0, #00, #01;;;; also could warp to game over screen here instead.
myLivesNotZero:
PlaySound #sfx_index_sfx_noteDead
LDA continueMap
STA warpMap
LDA continueX
STA newX
LDA continueY
STA newY
LDA continueScreen
STA warpToScreen
STA camScreen
WarpToScreen warpToMap, warpToScreen, #$02
+skipHurt