10 Coins or Collectibles Give Extra Life and Reset

TolerantX

Active member
Code:
;;This Collectible Tile Gives one 1up every 10 collected Thank You Dale Coop!;;
	CPX player1_object
	BEQ isPlayerForCollectableScore
	JMP ++
isPlayerForCollectableScore:
	LDA tileCollisionFlag
	BEQ +
	JMP ++
+
	LDA #$01
	STA tileCollisionFlag
	ChangeTileAtCollision #$00, #$00
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	STA tempx	

	AddValue #$02, 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

       ;;this adds 100 score. it is commented out because you may not want to add to yours.;;
	;AddValue #$07, myScore, #$01, #$02      ;;#$07 is I use 7 digits for my score change this for your game.;;
	;UpdateHud HUD_myScore

	PlaySound #SND_GET
	
	
	;; extra life stuff:
    LDA myMoney	;; checking the current unit digit of money is "0" (it means 10, 20, ... 90)?
    BNE +		;; if not "0" we skip
    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_1UP	;;add a new "SND_1UP" sfx;;
	
	;;reset myMoney count
    LDA #$00
    STA myMoney 	;; the element to be reset. one data line for each place in it's digits. ;;
    STA myMoney+1
	
	+


    LDX tempx
	++
 

Saulus_Lira

Member
Nice script. But it don´t works for me. This do nothing when i pickup the iten into screen.
I assign it to value 7 game object (AddValue #$07, myMoney, #$01, #$00), and counts to myMoney HUD (HUD element 5 for me).
maybe i have miss something.
 

Saulus_Lira

Member
Saulus_Lira said:
Nice script. But it don´t works for me. This do nothing when i pickup the iten into screen.
I assign it to value 7 game object (AddValue #$07, myMoney, #$01, #$00), and counts to myMoney HUD (HUD element 5 for me).
maybe i have miss something.

forget everything. i assign it to wrong bank :cry: :| :mrgreen: :lol: :lol: :lol: . its for tiles scripts and i defined it to poweerups.
all works perfectly.
 
Top Bottom