One-Time Music

AngelDog

  • Posts: 37
I have music play on my main menu, but every time I return to the menu the block is triggered for it to play again and it plays over the already playing music. Can anyone tell me a way I can make it so the scene detects the music is already playing so it doesn't go again?
beep bop

JeffreyDriver

  • Posts: 2262
Two basic options are to use a boolean. The first time the music plays switch the boolean to stop it playing again.

Option two, put a scene before the main menu that triggers the music.

BMJ

  • Posts: 278
Use the "Play [sound] On Channel [   ] " block instead of the "Play [sound]" block and Stencyl will automatically detect if the music is already playing on that channel. If it is, the music will continue uninterrupted.

(When you use the "Play [sound]" block, Stencyl just picks the first available channel to play the sound resource on, so this results in multiple instances of the music playing.)

AngelDog

  • Posts: 37
Use the "Play [sound] On Channel [   ] " block instead of the "Play [sound]" block and Stencyl will automatically detect if the music is already playing on that channel. If it is, the music will continue uninterrupted.

(When you use the "Play [sound]" block, Stencyl just picks the first available channel to play the sound resource on, so this results in multiple instances of the music playing.)
This hasn't worked.
beep bop

BMJ

  • Posts: 278
Are you certain that both scenes (the menu and the other scene) are using the same sound resource on the same channel? If so, can you share a picture of the code that plays your music? (from both scenes)