Help with Shop Tile

tbizzle

Well-known member
What I am trying to accomplish with this tile is:

#1. I want the tile to be able to subtract a value of 50 from my "myScore" variable, which has 8 places "00000050".

#2. If the "myScore" variable has a vaule of under 50, I want to RTS. (Just abort the script entirely)

#3. If the myScore has a value of 50 or over, I want the tile to subtract 50 from myScore and also add 10 to myAmmo.

#4. If myAmmo has a value of 90 or over, I want to RTS (abort the script) as well.

I am going for a Zelda type shop tile:
008.png
My code so far:
Code:
LDA myScore+1    ;; the hundreds digit of myCash
        CMP #5   ;; the "5" in 500    
        BCS +definitelyEnoughMoney
        JMP +notEnoughCash        
       
              +definitelyEnoughMoney:
           ChangeTileAtCollision #34, #00
           SubtractValue #8, myScore, #5, #$01
           UpdateHudElement #7
           LDA myAmmo_10    
           CMP #9
           BCS +
           AddValue #2, myAmmo, #10, #$01            
               +        
           UpdateHudElement #1
              +notEnoughCash:

So far I've changed it around various ways and I can never get it to work "together" as in it will either just add 10 to myAmmo and not subtract the 50 from myScore, or it'll subtract the 50 from myScore and not add 10 to myAmmo. Then sometimes it won't update the HUD until I have exited that particular screen. Any help is appreciated.
 
Last edited:

dale_coop

Moderator
Staff member
If you want to update multiple HUD elements at the same time, follow that topic:
 

NightMusic

Member
If you want to update multiple HUD elements at the same time, follow that topic:
Thank you @dale_coop ! this is coming as a primer right before the shop tile tutorial!
 

NightMusic

Member
@tbizzle should I make an entirely new forum topic in community tutorials on how to create Zelda shop screens or should I just make a video and link it here? Your topic, your call. Hugs.
 

NightMusic

Member
Last edited:
Top Bottom