Discuss Scratch

CharlieThe12Lobster
Scratcher
4 posts

How to have different music for different levels on a game

I would like to know if anyone can send me a code on how to make the music stop when the person completes the level and for the next level it has a new code.
willowmint-
Scratcher
500+ posts

How to have different music for different levels on a game

whenIreceivenew level
stopallsounds
playsoundsong

This coding should work
-ShadowOfTheFuture-
Scratcher
1000+ posts

How to have different music for different levels on a game

This should work…

whenclickedbroadcaststart musicwhenIreceivestart musicforeverplaysoundlevel# name the songs by their level number, so the level 1 song is named "1", the level 2 song "2", etc.whenIreceivenext level make sure this is broadcasted every time a level is beatenstopother scripts in spritebroadcaststart music

Last edited by -ShadowOfTheFuture- (March 26, 2019 22:57:33)

Flipped_
Scratcher
500+ posts

How to have different music for different levels on a game

-ShadowOfTheFuture- wrote:

This should work…

whenclickedbroadcaststart musicwhenIreceivestart musicforeverplaysoundlevel# name the songs by their level number, so the level 1 song is named "1", the level 2 song "2", etc.whenIreceivenext level make sure this is broadcasted every time a level is beatenstopother scripts in spritebroadcaststart music

Make sure to use a “play sound until done”, or else you'll get a weird glitching noise from the sounds playing on top of itself over and over again.
CharlieThe12Lobster
Scratcher
4 posts

How to have different music for different levels on a game

thank yall
CharlieThe12Lobster
Scratcher
4 posts

How to have different music for different levels on a game

where can i find the stop other scripts in this sprite because for every level I have different characters here is the link to my game https://scratch.mit.edu/projects/289944004 if you can make the code to work plz help me.
-SystemError-
Scratcher
59 posts

How to have different music for different levels on a game

Look for the “stop all” block in the Control section. It looks like this -
stopall

Click on the little triangle next to the “all” and select “other scripts in sprite”. Then you can use the “stop other scripts in sprite” block.
CharlieThe12Lobster
Scratcher
4 posts

How to have different music for different levels on a game

thank you so much you help me so much -SystemError-
-SystemError-
Scratcher
59 posts

How to have different music for different levels on a game

Glad I could help!
LoneSurvivr
Scratcher
22 posts

How to have different music for different levels on a game

I am making a scrolling gallery with various characters and when I press space, I want the character to change AND the music to change. How can I change to music?
Super_Scratch_Bros20
Scratcher
1000+ posts

How to have different music for different levels on a game

whenclickedsetLevelto1repeatuntilLevel=2playsoundLevel 1 Themeuntildone

whenIreceiveLevel 2setLevelto2stopallsoundsrepeatuntilLevel=3playsoundLevel 2 Themeuntildone

And so on.

Last edited by Super_Scratch_Bros20 (May 6, 2020 22:44:42)

phantom_pig
Scratcher
6 posts

How to have different music for different levels on a game

another thing
broadcast

start music

whenIreceive

start music

forever

playsound

level#

name the songs by their level number, so the level 1 song is named “1”, the level 2 song “2”, etc.

whenIreceive

next level

make sure this is broadcasted every time a level is beaten

stop

other scripts in sprite

broadcast

start music

change level # by 1

SuperCappy
Scratcher
500+ posts

How to have different music for different levels on a game

phantom_pig wrote:

another thing
broadcast

start music

whenIreceive

start music

forever

playsound

level#

name the songs by their level number, so the level 1 song is named “1”, the level 2 song “2”, etc.

whenIreceive

next level

make sure this is broadcasted every time a level is beaten

stop

other scripts in sprite

broadcast

start music

change level # by 1

)

whenIreceive start musicforeverplaysoundleveluntildonewhenIreceiveNEXT LEVELstopother scripts in spritebroadcaststart musicchangelevelby1
Here, fixed it for you

Last edited by SuperCappy (Dec. 1, 2020 10:09:10)

Super_Scratch_Bros20
Scratcher
1000+ posts

How to have different music for different levels on a game

Wait a minute. Two things:

1. Shouldn't this belong in Help With Scripts? After all, it's asking about the script to make different music on different levels.

2. Shouldn't this be closed? First, it's already answered. Second, it's from 2019, and was answered very finely – until someone said

LoneSurvivr wrote:

I am making a scrolling gallery with various characters and when I press space, I want the character to change AND the music to change. How can I change to music?

…which necroposted and bumped up the topic. In truth, you should ask questions on your own topics for the most part – especially if the topic you desire to post on is very old.

Powered by DjangoBB