1up sound not playing

red moon

Member
Hello everyone, I wanted to ask if I could get some help with a 1up sound playing when the player finds ten treasures.
The mechanics work, but I can only get the default "get" sound to play when I reach 10. I assigned the ExtraLife sound to SND_1UP and I altered the bottom of the script to reference the 1UP sound. That may not the right place to do that....
Thank you!

Here is the script
Code:
;;blank
	CPX player1_object
	BEQ isPlayerForCollectableScore
	JMP ++
isPlayerForCollectableScore:
	LDA tileCollisionFlag
	BEQ +
	JMP ++
+
	LDA #$01
	STA tileCollisionFlag
	ChangeTileAtCollision #$00, #$00
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	STA tempx	
	AddValue #$08, myScore, #$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_myScore
		; STA DrawHudBytes
	UpdateHud HUD_myScore
	PlaySound #SND_GET
	
	 ;; extra life stuff:
    LDA myScore+1
    BNE updateLives ;count equal to 10
    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_1UP
    
    
	
	+:
    LDX tempx
	++
 

Attachments

  • sound.jpg
    sound.jpg
    349.9 KB · Views: 1,173

Raftronaut

Member
hmmmm.
This is a shot in the dark, but I know that either nesmaker or famitracker does not like numerical digits or upper case letters in labels

For the sake of ruling everything out, I would try changing your FX name (in famitracker as well) to "SND_oneup" and take the capitol letters out of "ExtraLife" in your fami file...

It is possible that the PlaySound #SND_1UP command is in the incorrect place, but I would 1st eliminate any doubts of the issues mentioned above preventing GGsound from reading the labels correctly...

Just the advice I can offer at the moment
 

dale_coop

Moderator
Staff member
Weird, It think your script should play the sound as well...
You could try to modify it to NOT play the GET sound when your increase the life... something like this:

Code:
;;blank
	CPX player1_object
	BEQ isPlayerForCollectableScore
	JMP ++
isPlayerForCollectableScore:
	LDA tileCollisionFlag
	BEQ +
	JMP ++
+
	LDA #$01
	STA tileCollisionFlag
	ChangeTileAtCollision #$00, #$00
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	STA tempx	
	AddValue #$08, myScore, #$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_myScore
		; STA DrawHudBytes
	UpdateHud HUD_myScore
	
	 ;; extra life stuff:
	LDA myScore+1
	BNE updateLives ;count equal to 10
	
	PlaySound #SND_GET
	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_1UP
    
    
	
	+:
    LDX tempx
	++
 

red moon

Member
Dale, I had to revert to the previous script...once I did more more testing I found that any score increase past 10 resulted in an extra life!
It would play the default "ping" for 01-09, then extra life sound at 10. Unfortunately, every pickup afterward played the extra life sound and gave additional life to the player...
 

red moon

Member
Hmm, I am not sure... even after copying the script I had at the top and replacing the changes it is still adding extra lives....
 

dale_coop

Moderator
Staff member
Your script might be the correct... I just checked again... and I think the one you shared in the first message (the one I just modified for playing the sound correctly) is NOt the correct ExtraLife script I fixed for your some days ago.
Here's the correct one modified you could test again:

Code:
;;blank
	CPX player1_object
	BEQ isPlayerForCollectableScore
	JMP ++
isPlayerForCollectableScore:
	LDA tileCollisionFlag
	BEQ +
	JMP ++
+
	LDA #$01
	STA tileCollisionFlag
	ChangeTileAtCollision #$00, #$00
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	STA tempx	

	AddValue #$02, myScore, #$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_myScore
		; STA DrawHudBytes
	UpdateHud HUD_myScore
	
	
	;; extra life stuff:
	LDA myScore	;; checking the current unit digit of the score 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
	JMP +++
	+
	PlaySound #SND_GET
+++


	LDX tempx
++
 

red moon

Member
Ah, thank you.
You are right, it is different. This helps, I will plug this back in for now since the amount of lives greatly effects difficulty.
 
Top Bottom