1up sound not playing

User avatar
red moon
Posts: 421
Joined: Mon Aug 12, 2019 12:19 am

1up sound not playing

Post by red moon » Sun Nov 10, 2019 10:01 pm

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: Select all

;;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.93 KiB) Viewed 901 times
User avatar
Raftronaut
Posts: 336
Joined: Mon Sep 03, 2018 4:47 pm

Re: 1up sound not playing

Post by Raftronaut » Fri Nov 22, 2019 10:55 pm

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
Space Raft demo updates: [url]http://nesmakers.com/viewtopic.php?f=52&t=2867[/url]

Chiptune:[url] https://soundcloud.com/user-634230995-350638590 [/url]
User avatar
dale_coop
Posts: 5179
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: 1up sound not playing

Post by dale_coop » Sat Nov 23, 2019 5:36 pm

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: Select all

;;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
	++ 
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
User avatar
red moon
Posts: 421
Joined: Mon Aug 12, 2019 12:19 am

Re: 1up sound not playing

Post by red moon » Sun Nov 24, 2019 12:33 am

That worked! Thank you both for looking at this so closely!
I one bug down which is great!
User avatar
red moon
Posts: 421
Joined: Mon Aug 12, 2019 12:19 am

Re: 1up sound not playing

Post by red moon » Sun Nov 24, 2019 12:43 am

And to clarify, it was using the script that was altered to not play the sound...very odd!
User avatar
red moon
Posts: 421
Joined: Mon Aug 12, 2019 12:19 am

Re: 1up sound not playing

Post by red moon » Sun Nov 24, 2019 9:35 pm

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...
User avatar
red moon
Posts: 421
Joined: Mon Aug 12, 2019 12:19 am

Re: 1up sound not playing

Post by red moon » Sun Nov 24, 2019 9:41 pm

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....
User avatar
dale_coop
Posts: 5179
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: 1up sound not playing

Post by dale_coop » Mon Nov 25, 2019 3:02 pm

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: Select all

;;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
++ 
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
User avatar
red moon
Posts: 421
Joined: Mon Aug 12, 2019 12:19 am

Re: 1up sound not playing

Post by red moon » Mon Nov 25, 2019 4:50 pm

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.
User avatar
red moon
Posts: 421
Joined: Mon Aug 12, 2019 12:19 am

Re: 1up sound not playing

Post by red moon » Tue Nov 26, 2019 12:10 am

That did it Dale and now it plays the correct sound when getting an extra life! You have my thanks!!!
Post Reply