;;; key powerup code
LDA myKeys
CLC
ADC #$01
CMP #$08 ;;<<-- the limit (when the player gets the 8th he wins)
BCS playerWinGame
STA myKeys
;;;;;;;;;;;;; UPDATE HUD
LDA #$01 ;; amount of score places?
STA hudElementTilesToLoad
LDA DrawHudBytes
ORA #HUD_myKeys
STA DrawHudBytes
;;; trigger screen so it enteres triggered mode
;; and you can't continue to get the key again
TriggerScreen screenType
JMP continueWithKeys
playerWinGame:
LDA #STATE_WIN_GAME
STA change_state
LDA #$01
STA newScreen
continueWithKeys:
PlaySound #SFX_GET_KEY
;;; key powerup code
LDA myKeys
CLC
ADC #$01
CMP #$08 ;;<<-- the limit (when the player gets the 8th he wins)
BCS playerWinGame
STA myKeys
;;;;;;;;;;;;; UPDATE HUD
LDA #$01 ;; amount of score places?
STA hudElementTilesToLoad
UpdateHud HUD_myKeys
;;; trigger screen so it enteres triggered mode
;; and you can't continue to get the key again
TriggerScreen screenType
JMP continueWithKeys
playerWinGame:
LDA #STATE_WIN_GAME
STA change_state
LDA #$01
STA newScreen
continueWithKeys:
PlaySound #SND_GET
;;; key powerup code
LDA myKeys+1
CMP #$09
BCC +
LDA myKeys
CMP #$09
BCC +
JMP playerWinGame
+
AddValue #$02, myKeys, #$01, #$00
;;;;;;;;;;;;; UPDATE HUD
LDA #$01 ;; amount of score places?
STA hudElementTilesToLoad
UpdateHud HUD_myKeys
;;; trigger screen so it enteres triggered mode
;; and you can't continue to get the key again
TriggerScreen screenType
JMP continueWithKeys
playerWinGame:
LDA #STATE_WIN_GAME
STA change_state
LDA #$01
STA newScreen
continueWithKeys:
PlaySound #SND_GET