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

#1 2010-01-11 18:48:11

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Need help with Music control in my project..

Hey guys,
I have been trying to add music into my project, this works fine, but I also want a Music control sprite so if it's clicked it stops music and starts it again if clicked again.
I want it to have two costumes, one for Music ON and Music OFF.

I tried multiple things to get this to work, it worked offline but online it didn't.
Any ideas for scripts I could use?
Thanks guys =]

Offline

 

#2 2010-01-11 22:56:50

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: Need help with Music control in my project..

sad *

Offline

 

#3 2010-01-11 23:05:31

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Need help with Music control in my project..

If you want the music to restart when it's been turned off:

When Music_off clicked
Stop all sounds

When Music_on clicked
Play music

If you want the music to continue:

When Music_off clicked
set volume to 0

When Music_on clicked
set volume to 100

Do those work?


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#4 2010-01-11 23:09:07

cocoanut
Scratcher
Registered: 2007-07-10
Posts: 1000+

Re: Need help with Music control in my project..

To do it all with one sprite, and changing costumes:

[When Green Flag Clicked]
[Set variable "on" to 1]
[forever]
    [If spriteButton clicked?]
       [If on = 1]
           [switch to costume "off"]
           [stop all sounds]
       [Else]
           [switch to costume "on"]
           [play sound "sound"]
       [End If]
[End Forever]

Hope that works.  smile

Last edited by cocoanut (2010-01-11 23:13:21)


http://i42.tinypic.com/20gyvif.jpgPlease leave a message at the beep.
Steam: Hellephant

Offline

 

#5 2010-01-12 01:54:11

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: Need help with Music control in my project..

Ahh thanks Chris + coco
I was trying things like way more complex, fail me, just proves that it doesn't have to be complex to work  big_smile

Offline

 

#6 2010-01-12 01:57:51

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Need help with Music control in my project..

Complexity is good for space and simplicity helps get the project to work.  tongue

Last edited by Chrischb (2010-01-12 01:58:02)


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#7 2010-01-12 04:05:08

JaredxD
Scratcher
Registered: 2009-09-10
Posts: 100+

Re: Need help with Music control in my project..

haha thanks =]
Please do check out the game this was used for:
http://scratch.mit.edu/projects/JaredxD/835793

Click love it and comment!  big_smile

Offline

 

Board footer