Discuss Scratch

adammos330
Scratcher
5 posts

Music switcher

so I have a game where I want to make it so if you click a button it goes to the next song and then silent.

there's only 2 songs and then the silence.

whenthisspriteclickedforeverifMUSIC(variable)=1thenrepeatuntilnotmusic=1playsoundsonguntildone

this is what I tried with other similar scripts but it keeps playing the same song
deck26
Scratcher
1000+ posts

Music switcher

There are various ways to resolve this but if you're using play sound until done you'll need another script to interrupt the sound.

An easy option is to use clones. To start a new sound set a variable to the song name, delete any clones (broadcast), create a new clone and get it to play sound until done in a broadcast using the variable to choose the sound. To stop all sounds just delete the clones..
adammos330
Scratcher
5 posts

Music switcher

I fixed this problem by simply naming the songs like song 1 and then doing this:

whenthisspriteclickedifMUSIC=song 1thenwait0.1secssetMUSICtosong 2broadcastPlay New Music

Also with…

whenIreceivePlay new musicstopallsoundsforeverplaysoundMUSICuntildone

Powered by DjangoBB