Discuss Scratch

BroOn4tn1t
Scratcher
39 posts

how to make music play and stop when clicking a sprite

Conduit7 wrote:

RebeccaKi wrote:

how do you do the thing where ok so it plays music and then when you click another sprite the music stops playing im trying to make a game
just use the same code i already put up lol
this has been already solved dude please stop posting on this

,———-BroOn4tn1t———-

PCK_Gamer
Scratcher
29 posts

how to make music play and stop when clicking a sprite

when this sprite clicked
if <(volume) = [0]> then
set volume to (100) %
else
set volume to (0) %
end
when green flag clicked
repeat until <>
play sound [Rick astley - Never gonna give you up.MP3 v] until done
end

define do a signature
think on [something]
write [this dumb signature]
feel [proud v] of [yourself v]
FinalDFan
Scratcher
1 post

how to make music play and stop when clicking a sprite

I'm trying to make a game, and what's supposed to happen is that when a sprite is clicked, the music is supposed to sop permanently. But no matter how hard I try, I just can't seem to figure out how to do it. What should I do?
cIoudyness
Scratcher
500+ posts

how to make music play and stop when clicking a sprite

FinalDFan wrote:

I'm trying to make a game, and what's supposed to happen is that when a sprite is clicked, the music is supposed to sop permanently. But no matter how hard I try, I just can't seem to figure out how to do it. What should I do?
next time create a new topic for your request. reusing old topics is necroposting and a little bit frowned upon.

you can try a repeat until touching mouse and mouse down: play sound or a when sprite clicked: set volume to 0

brownies and kittens and all such nice things
Linas-T
Scratcher
1 post

how to make music play and stop when clicking a sprite

xMystic416 wrote:

when this sprite clicked
broadcast [ music]
when I receive [  music]
if <[music] = [off]> then


set [ music] to [on]
play sound [ v] until done
else
set [ music] to [off]
stop all sounds
end
for the stop all sounds you can also switch it with the
set volume to (0) %
if it doesn't work

xMystic416 wrote:

when this sprite clicked
broadcast [ music]
when I receive [  music]
if <[music] = [off]> then


set [ music] to [on]
play sound [ v] until done
else
set [ music] to [off]
stop all sounds
end
for the stop all sounds you can also switch it with the
set volume to (0) %
if it doesn't work
It doesn't work?
CreamyJusticeOG
Scratcher
3 posts

how to make music play and stop when clicking a sprite

I need help with making it where if I click on a sprite it stops and when I click it again I need it to turn back on. If you help you get mentioned in my game
housemuseum
Scratcher
100+ posts

how to make music play and stop when clicking a sprite

Linas-T wrote:

xMystic416 wrote:

when this sprite clicked
broadcast [ music]
when I receive [  music]
if <[music] = [off]> then


set [ music] to [on]
play sound [ v] until done
else
set [ music] to [off]
stop all sounds
end
for the stop all sounds you can also switch it with the
set volume to (0) %
if it doesn't work

xMystic416 wrote:

when this sprite clicked
broadcast [ music]
when I receive [  music]
if <[music] = [off]> then


set [ music] to [on]
play sound [ v] until done
else
set [ music] to [off]
stop all sounds
end
for the stop all sounds you can also switch it with the
set volume to (0) %
if it doesn't work
It doesn't work?
and

CreamyJusticeOG wrote:

I need help with making it where if I click on a sprite it stops and when I click it again I need it to turn back on. If you help you get mentioned in my game
you guys are necroposting and it would make better sense to create a brand new topic.

i only use this account for forums, except for when my new account becomes a scratcher.
new acc is @RethinkingVoxels
fake_flamingolol
Scratcher
3 posts

how to make music play and stop when clicking a sprite

Hello Guys i am making a Simulator game where if you click on a sprite called “Shop” then it will make the background music for outside then stop but when you exit then the shop music will stop and here is the script im using
when this sprite clicked
broadcast [ v]

when I receive [ v]
forever
play sound [ v] until done
end

Last edited by fake_flamingolol (March 23, 2024 16:27:59)

The_2nd_Peep
Scratcher
3 posts

how to make music play and stop when clicking a sprite

BroOn4tn1t wrote:

when i click the sprite it just restarts the song
when green flag clicked
forever
if <(music) = [on]> then
set volume to (100) %


else
set volume to (0) %

when green flag clicked
forever
play sound [ v] until done
end

when green flag clicked
forever
if <<mouse down?> and <touching [mouse pointer v] ?>> then
if <(music) = [on]> then
set [music v] to [off]



else
set [music v] to [on]
end
end
end
Malicondi
Scratcher
1000+ posts

how to make music play and stop when clicking a sprite

Please stop necroposting, this topic is several years old and is solved.

post #1000 post #100 i help in the forums post #1 post #500 0 second ninja
I recommend reading jvvg's essay about the scratch team before complaining, as it may change your opinion and provide insight on the topic.

coming soon :)


Powered by DjangoBB