n8bit
Member
I am trying to add to the collectable script so that when you collect 100 items you get an extra life and the count resets.
When I tested with a low number like 3 (#$03) the script worked great, but when I changed it to 100 (#$64) it does not work at all.
here is my script...
When I tested with a low number like 3 (#$03) the script worked great, but when I changed it to 100 (#$64) it does not work at all.
here is my script...
Code:
;;blank
CPX player1_object
BEQ isPlayerForCollectable
JMP ++
isPlayerForCollectable:
LDA tileCollisionFlag
BEQ +
JMP ++
+
LDA #$01
STA tileCollisionFlag
ChangeTileAtCollision #$00, #$60
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TXA
STA tempx
AddValue #$08, myMoney, #$01, #$00
;;; we also need to set up the routine to update the HUD
;; for this to work right, health must be a "blank-then-draw" type element.
;STA hudElementTilesToLoad
; LDA #$00
; STA hudElementTilesMax
; LDA DrawHudBytes
; ora #HUD_myMoney
; STA DrawHudBytes
UpdateHud HUD_myMoney
PlaySound #SND_CART
LDA #$00
STA value
STA value+1
STA value+2
STA value+3
STA value+4
STA value+5
STA value+6
STA value+7
;; extra life stuff:
LDA myMoney
CMP #$64 ;compare count (must be 100)
BEQ updateLives ;count equal to 100
JMP +
updateLives:
LDA myLives
ADC #$01 ;add 1 to lives
STA myLives
;; update the count in hud
STA hudElementTilesToLoad
UpdateHud HUD_myLives
;; play 1UP sound
PlaySound #SND_GET
;;reset myMoney count
LDA #$00
STA myMoney
STA myMoney+1
STA myMoney+2
+:
LDX tempx