2OL1
2OL1

Reputation: 87

Sound interaction between two sprites in MIT Scratch

I am trying to create a DJing program in which one song starts when a sprite is clicked and another song starts (and the first one stops) when a second sprite is clicked. My solution has been to create a variable and use it as an on/off boolean, however the first song continues when the second song is activated. The code for the other sprite is the same with the variables changed.enter image description here

Upvotes: 1

Views: 514

Answers (2)

2OL1
2OL1

Reputation: 87

I misstated the question: I'd actually like to keep one song playing (even if the other song is activated) until the related sprite (button) is clicked again. But using the suggestion of 'set volume to 0%' I was able to create this solution: enter image description here

Upvotes: 1

Coder2195
Coder2195

Reputation: 277

In fact you need no boolean. For first sprite the code is

When sprite clicked

stop all sounds

start sound (whatever sound you have)

For other sprite you do the same thing

Upvotes: 0

Related Questions