Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Menu music
- tbpatj
-
44 posts
Menu music
So I am trying to get my game so in the menu it plays some music I am using some off of scratch right now until I decide but I want it so that it keeps on playing that music during the tittle screen and all through out the menu and keep on playing until I choose story mode or a free play level here is my game Rocket Rescue can anybody help me with this I would really appreciate it
Last edited by tbpatj (June 6, 2013 16:37:12)
- manwithmanykids
-
67 posts
Menu music
I think you could do the following
Create a Variable, MusicON.
In the back drop under the green flag, step it to on
Create a new event that listens for he broadcast Music
in the event create a forever loop and in the loop create and if then as Follows
Forever until MusicON = ‘OFF’
If MusicON = ‘ON’ then
PlayMusic until Done
end if
End Forever
Stop All Sounds
Now Just Change the Variable MusicOn to Off
Create a Variable, MusicON.
In the back drop under the green flag, step it to on
Create a new event that listens for he broadcast Music
in the event create a forever loop and in the loop create and if then as Follows
Forever until MusicON = ‘OFF’
If MusicON = ‘ON’ then
PlayMusic until Done
end if
End Forever
Stop All Sounds
Now Just Change the Variable MusicOn to Off
- mwiedmann
-
100+ posts
Menu music
First create a global variable called “MusicState”.
When your menu launches, do a “broadcast menu_music_on”.
When your menu is closed, do a “broadcast menu_music_off”
On your Stage (or whatever Sprite has the music) have these 2 handlers:
When I receive menu_music_on
Set MusicState=1
Repeat until MusicState=0
play sound menu_music until done
When I receive menu_music_off
Set MusicState=0
stop all sounds
I think this will work.
- dememes2001
-
4 posts
Menu music
I think you could do the following https://scratch.mit.edu/projects/327550106/editor
Create a Variable, MusicON.
In the back drop under the green flag, step it to on
Create a new event that listens for he broadcast Music
in the event create a forever loop and in the loop create and if then as Follows
Forever until MusicON = ‘OFF’
If MusicON = ‘ON’ then
PlayMusic until Done
end if
End Forever
Stop All Sounds
Now Just Change the Variable MusicOn to Off
like this? click the sprite that is invisible.
Last edited by dememes2001 (Oct. 22, 2019 19:50:30)
- Zizzle8383
-
100+ posts
Menu music
DONT NECROPOST this is from 2013 dudeI think you could do the following https://scratch.mit.edu/projects/327550106/editor
Create a Variable, MusicON.
In the back drop under the green flag, step it to on
Create a new event that listens for he broadcast Music
in the event create a forever loop and in the loop create and if then as Follows
Forever until MusicON = ‘OFF’
If MusicON = ‘ON’ then
PlayMusic until Done
end if
End Forever
Stop All Sounds
Now Just Change the Variable MusicOn to Off
like this? click the sprite that is invisible.
Last edited by Zizzle8383 (Oct. 22, 2019 20:54:16)
- Floatiee798
-
1 post
Menu music
Sorry i didn't know you couldn't delete comments
Last edited by Floatiee798 (May 3, 2020 16:22:13)
- djcatboyayS
-
2 posts
Menu music
Thank you that worked
Last edited by djcatboyayS (Oct. 7, 2023 18:08:25)
- dkps67
-
23 posts
Menu music
I think you could do the following https://scratch.mit.edu/projects/327550106/editor
Create a Variable, MusicON.
In the back drop under the green flag, step it to on
Create a new event that listens for he broadcast Music
in the event create a forever loop and in the loop create and if then as Follows
Forever until MusicON = ‘OFF’
If MusicON = ‘ON’ then
PlayMusic until Done
end if
End Forever
Stop All Sounds
Now Just Change the Variable MusicOn to Off
like this? click the sprite that is invisible.
is the varible, musicON global or local?
- Discussion Forums
- » Help with Scripts
-
» Menu music