(gun pickup) Ammo pickups not maxing out 4.5.9

TheRetroBro

Active member
So currently I have 2 ammo options. i noticed in my gun pickup line it will max out (show max on screen at 8) but its storing all the pickups so i can pickup as much as i can. This is fine untill you stack it to high and the game crashes. I would like to cap it at 8 Can anyone assist here on what im missing?

LDA Object_type,x
CMP #$01 ;;What object is your pickup? 00 - 0f
BNE notThisPickup1
;;;;;;;;;;;;;;;;;;;;;;;;; What do you want to do to the value?
;;;;;;;;;;;;;;;;;;;;;;;;; Increase? Decrease? Set it to a number?
;;;;;;;;;;;;;;;;;;;;;;;;; Here, we are setting myPrizes to 5.
inc myPrizes
LDA myPrizes
CMP #10
BNE notTenYet1
;; is ten
;; reset myPrizes
LDA #$00
STA myPrizes
;; increase lives

INC myLives
LDA myLives
CMP #$09
BNE notMaxLivesAt8_1
;;; normalize lives at max of 6
LDA #$08
STA myLives
notMaxLivesAt8_1
JMP endPickups1
notTenYet1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;; Do we need to update the HUD to reflect this?
;;;;;;;;;;;;;;;;;;;;;;;;; If so, which element is the above variable represented in?
;UpdateHudElement #$03
JMP endPickups1
notThisPickup1:

LDA Object_type,x
CMP #$02 ;;Pickup object gun
BEQ gunPickup
CMP #$05 ;;Pickup object 1UP
BEQ oneUpPickup
JMP endPickups1

gunPickup:
PlaySound #sfx_index_sfx_powerup

LDA myAmmo
CMP #3
LDA #3
INC myAmmo
BNE Not8Yet
LDA #3
BCS maxAmmo
INC myAmmo
JMP endPickups1
maxAmmo:
Not8Yet
JMP endPickups1


oneUpPickup:
PlaySound #sfx_index_sfx_powerup
INC myLives ; Increment the value of myLives by 1
LDA myLives
CMP #$09 ; Check if myLives is greater than 8
BCC notMaxLivesAt8_1_new ; Branch if myLives is less than or equal to 8
LDA #$08 ; Set myLives to 8 if it exceeds 8
STA myLives
notMaxLivesAt8_1_new:



JMP endPickups1

endPickups1:
;;; object will already destroy based on type.
 

smilehero65

Active member
Hi! I am trying to help, but I don't really understand how your pickup works on the game.
Could you please be more exact and detailed of how it is supposed to work?šŸ˜…
 
Top Bottom