PDA

View Full Version : How do you stop a sound?


7yrold4Alice
07-16-2013, 05:37 PM
How do you stop a sound? I want it like if you enter a room, the "Main sound" stops and a different sound starts. Help!

DensetsuNoKaboom
07-17-2013, 04:57 AM
Create a Boolean variable, and set it to "true" when you want the song to start playing, and add a method to set it to "false" when you want the song to stop playing. Then make an event that says "while [variable] is true, play sound [music]".
If you want to have multiple pieces of music in your world, you could create a sound variable, and whenever you want the music to change, set the Boolean to false, change the sound variable to the new music, and set the Boolean to true again.

chickentree
07-17-2013, 10:17 AM
Create a Boolean variable, and set it to "true" when you want the song to start playing, and add a method to set it to "false" when you want the song to stop playing. Then make an event that says "while [variable] is true, play sound [music]".
If you want to have multiple pieces of music in your world, you could create a sound variable, and whenever you want the music to change, set the Boolean to false, change the sound variable to the new music, and set the Boolean to true again.

I thought sound was "play it all" in Alice and that once started it would continue until the track was done. Is this not true?
Mark

7yrold4Alice
07-17-2013, 11:58 AM
thanks!:cool:

It works!

7yrold4Alice
07-17-2013, 12:20 PM
wait... The sound doesn't stop. Am I doing something wrong?

I made a Boolean variable, set it to false, and made it set to true when you are near something. I made Boolean variables for every sound and when ever a new sound comes, I set all the other Boolean variables to false, but the sound keeps on playing!

what is happening? :confused:

bob3584
07-18-2013, 12:16 AM
Make sure you didn't miss something or make an error in your logic.

DensetsuNoKaboom
07-19-2013, 06:20 AM
Post your world so we can look at it? That usually helps.

sfunk
07-19-2013, 03:34 PM
Make sure that the method that has the sound playing is being constantly checked with a loop of some kind. And sometimes, depending on the size of the sound file or type it is, it may not work properly or immediately.