This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-02-13 08:13:58

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

A muter

Hey guys,

As you can see in my sig, I'm working on a game called the bomb. Some people might find the heartbeat sound quite annoying so I want to put a mute button on.

Any ideas how to do this? I tried but I can't make it stop straight away.


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#2 2010-02-13 08:21:26

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: A muter

You can use this block on the sprite that's making a noise saying "set sound to 0%"


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#3 2010-02-13 08:27:33

RHY3756547
Scratcher
Registered: 2009-08-15
Posts: 1000+

Re: A muter

Since scratch's volume controls only work for the sprite that it is on, you need to use a variable, call it mute. Put this script in all of the objects that make sound:

<when green flag clicked>
<forever>
<if><( Mute <=> 1 )>
Set Volume to 0%
<else>
Set Volume to 100%
<end>

Offline

 

#4 2010-02-13 08:42:38

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: A muter

Doesn't seem to work. I need a mute toggler.

Edit false Alarm didn't see the one up front. I'll try that.

Last edited by Stickman704 (2010-02-13 08:46:48)


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#5 2010-02-13 08:50:25

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: A muter

Ok thank you. Any idea how to turn it back on again?


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#6 2010-02-13 09:40:01

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: A muter

Put this script:

<when green flag clicked>
<forever>
<if><< <key[ m ]pressed?> <and> <( Mute <=> 1 )> >>
<set{ Mute }to( 0
<end>
<if><< <key[ m ]pressed?> <and> <( Mute <=> 0 )> >>
<set{ Mute }to(1
<end>

Really you can use any key you want, but I just put m as an example.

Last edited by steppenwulf (2010-02-13 09:47:41)


I'm graduating HS this April and going to college in the Fall.

Offline

 

#7 2010-02-13 10:03:45

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: A muter

Thanks for all your help. Unfortunatly none of them did seem to work but then I was so stupid that I didn't think to make a volume slider so that's what i've done.

This thread can be locked since it has been resolved.


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

Board footer