How do I pause music with the click of a button and unpause it with a click of a button? Please help, ANYBODY!
Offline
HarryPotterGal wrote:
How do I pause music with the click of a button and unpause it with a click of a button? Please help, ANYBODY!
maybe like when a key pressed stop all sounds and when b key pressed play drum beat for 42 etc
Offline
HarryPotterGal wrote:
How do I pause music with the click of a button and unpause it with a click of a button? Please help, ANYBODY!
o and by the way next time post somethign like this is all about scratch or advanced scratch
Offline
HarryPotterGal wrote:
How do I pause music with the click of a button and unpause it with a click of a button? Please help, ANYBODY!
I'm sorry to say, but I don't think that is possible in Scratch at the moment. You can stop it with the "Stop All Sounds" block but there is no way that I know of to start it back up again from the place where you stopped it.
Probably the closest you could come would be to break the sound up into a series of shorter sound segments...then use a couple of variables and IF blocks to control which segment to play next. You could get pretty close with that approach, but the sound would be pretty rough.
Offline
If you don't mind the music starting from the beginning when you click the sound on, try this. Create a sprite and put the following scripts in it. When you click the sprite, the music will toggle on and off.
[blocks]
<when green flag clicked>
<set{ playsound }to( 1
<forever>
<if><( <{ playsound }> <=> 1 )>
<play sound[ music ]and wait>
<end>
<end>
<when[ mute sprite ]clicked>
<set{ playsound }to( (( 1 <-> <{ playsound }> ))
<if> <( <{ playsound }> <=> 0 )>
<stop all sounds>
<end>
[/blocks]
Note that "play sound and wait" has been replaced by "play sound until done" in Scratch 1.2. This method will also stop any sound effects that are currently playing when the mute sprite is clicked.
Offline