ostincoolston
Member
So I used the myScore from the platform tutorial, set up the HUD exactly the way Joe did (except I used the text DEATHS instead of SCORE in the HUD) using the myScore variable. Then I copied the AddValue code that was used to add score when you pick up a carrot or stomp a monster and pasted it into the HandlePlayerDeath scripts like this,
Code:
TXA
STA tempx
TYA
STA tempy
;;;;;;;;;;;;;;;;;;;
LDX player1_object
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
CreateObject temp, temp1, #$08, #$00
;; need to do this redundantly, otherwise, the death object will be in same slot as player
LDA #$00
SEC
SBC #$06
STA Object_v_speed_hi,x
LDX player1_object
AddValue #$06, myScore, #$01, #$00
;;;constant how many places, what variable, how much to change (0-9), what place to change (0=ones, 1=tens, etc etc etc)
;;;;
LDA DrawHudBytes
ora #HUD_myScore
STA DrawHudBytes
DeactivateCurrentObject
;;;;;;;;;;;;;;;;;;;
StopSound
LDA #$FF
STA player1_object
LDX tempx
LDY tempy
RTS