Changing Scene & Stopping a Sound
KatApps
Member, PRO Posts: 84
Hey all,
I have scenes in a game that contain Sound buttons that when tapped will play ongoing sounds. All the scenes also have Next and Back buttons to change scenes. Currently, if a user hits a Sound button within the scene and then hits the Next button, the sound continues to play into the next scene.
Anyone know how I would get the sound to stop when the user hits the Next or Back button?
Thanks!
Kat
I have scenes in a game that contain Sound buttons that when tapped will play ongoing sounds. All the scenes also have Next and Back buttons to change scenes. Currently, if a user hits a Sound button within the scene and then hits the Next button, the sound continues to play into the next scene.
Anyone know how I would get the sound to stop when the user hits the Next or Back button?
Thanks!
Kat
Comments
@KatApps Hi Kat, for the sound to stop when a Change Scene behaviour is used, the Run to completion in the Play Sound behaviour needs to be unchecked.
One thing to watch out for though: if the sounds in your Sound buttons are triggered just by touch rules, and the sound behaviour is unchecked, the sound will only play while touch is pressed.
One way around this is to give each button it's own boolean "switch":
Rule: When touch is pressed
Change Attribute SndA1play to true
Rule: When SndA1play is true
Play Sound SndA1play --- Run to completion unchecked
Timer: After ? seconds ---- ? is the length of the sound, in this case the length of time to play SndA1play
Change Attribute SndA1play to false
Hope that helps. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
This seems to be working in that when the scene changes the sound from the previous scene stops.. yay!
What's happening now though is that the sound on the next scene is automatically being triggered when first entering that scene, without the touch of a button (which is not what I intend for it it do).. have any ideas on how to change this?
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thanks again @gyroscope .. your response is much appreciated!
You're welcome. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps