Discuss Scratch

Luigibro16_
Scratcher
4 posts

Different Menu Music

I'm trying to make the main menu where a character shows up on the left side of the screen and when a specific character shows up, different menu music plays. But I can't make it work right and it's pretty buggy. Help Needed!!

Sub to me. Do It
https://www.youtube.com/channel/UCaFDFwd_FAd7ovnQYB-xLlQ
D-ScratchNinja
Scratcher
1000+ posts

Different Menu Music

You can switch to different looping music by using specific blocks and a sprite that contains all the music or the stage. The play sound until done has the ability to stop playing the selected sound when the block is stopped. We can use a stop other scripts in sprite to make that happen. So you could code your music to play like this for example:
when I receive [Menu v]
stop [other scripts in sprite v]
forever
play sound [Menu music v] until done
end

when I receive [Levels v]
stop [other scripts in sprite v]
forever
play sound [Level select music v] until done
end
etc.

D-ScratchNinja • he/him
- The following is my signature, which always shows up below my posts. -


New! Filter through my projects with my website.

Need to fix an issue? Check out this studio for solutions to some common problems!

OS: Windows 11 / Browser: Microsoft Edge / Time zone: PST/PDT
Huckleberry256
Scratcher
100+ posts

Different Menu Music

It's a good idea to put all your music and music sprites into one sprite to keep things organized and to also make sure stuff just works. In your music sprite, put this script:

when I receive [main menu v]
wait (0) secs // this makes the sprite wait 1 frame, you might need this or you might not. (see below)
if <([costume # v] of [character v]) = [1]> then
forever
play sound [character 1 music v] until done
end
end
if <([costume # v] of [character v]) = [2]> then
forever
play sound [character 2 music v] until done
end
end
...

If you notice that it's not playing the right music, put the “wait 0 seconds” block there and it should work.

Let me know if you have any questions!

(If you're interested, double-click and press shift and down arrow to see the rest of my signature.)

I'm Huckleberry, your average video game enjoyer and developer. PvZ and Minecraft fan, among other things. Nerd, especially in music. Generally a goofy human being.

usually I'll go on the Help with Scripts forum so you might see me there every now and then
see my profile to see what I'm up to I guess



over 2 stacks of posts

Some of my best projects can be found here: https://scratch.mit.edu/studios/27944298/

Happy Scratching!
Luigibro16_
Scratcher
4 posts

Different Menu Music

Luigibro16_ wrote:

I'm trying to make the main menu where a character shows up on the left side of the screen and when a specific character shows up, different menu music plays. But I can't make it work right and it's pretty buggy. Help Needed!!
Oh yeah there is also animation

Sub to me. Do It
https://www.youtube.com/channel/UCaFDFwd_FAd7ovnQYB-xLlQ
Luigibro16_
Scratcher
4 posts

Different Menu Music

Huckleberry256 wrote:

It's a good idea to put all your music and music sprites into one sprite to keep things organized and to also make sure stuff just works. In your music sprite, put this script:

when I receive [main menu v]
wait (0) secs // this makes the sprite wait 1 frame, you might need this or you might not. (see below)
if <([costume # v] of [character v]) = [1]> then
forever
play sound [character 1 music v] until done
end
end
if <([costume # v] of [character v]) = [2]> then
forever
play sound [character 2 music v] until done
end
end
...

If you notice that it's not playing the right music, put the “wait 0 seconds” block there and it should work.

Let me know if you have any questions!
This Seems like it works, But the menu characters have animation, is there a way with animation?

Sub to me. Do It
https://www.youtube.com/channel/UCaFDFwd_FAd7ovnQYB-xLlQ
D-ScratchNinja
Scratcher
1000+ posts

Different Menu Music

Luigibro16_ wrote:

This Seems like it works, But the menu characters have animation, is there a way with animation?
Do you need the music to sync up with the animation or is this a separate question?

D-ScratchNinja • he/him
- The following is my signature, which always shows up below my posts. -


New! Filter through my projects with my website.

Need to fix an issue? Check out this studio for solutions to some common problems!

OS: Windows 11 / Browser: Microsoft Edge / Time zone: PST/PDT
Luigibro16_
Scratcher
4 posts

Different Menu Music

D-ScratchNinja wrote:

Luigibro16_ wrote:

This Seems like it works, But the menu characters have animation, is there a way with animation?
Do you need the music to sync up with the animation or is this a separate question?
both

Sub to me. Do It
https://www.youtube.com/channel/UCaFDFwd_FAd7ovnQYB-xLlQ
Huckleberry256
Scratcher
100+ posts

Different Menu Music

Luigibro16_ wrote:

This Seems like it works, But the menu characters have animation, is there a way with animation?

Just make sure the costume number you put in matches with the costume the animation starts on. If character 1 starts on costume #1, put in a 1; if character 2 starts on costume 7, put in a 7; etc. The script only checks for the costume number once, so once it starts you don't have to worry about it changing.

Last edited by Huckleberry256 (Aug. 29, 2021 00:53:02)


(If you're interested, double-click and press shift and down arrow to see the rest of my signature.)

I'm Huckleberry, your average video game enjoyer and developer. PvZ and Minecraft fan, among other things. Nerd, especially in music. Generally a goofy human being.

usually I'll go on the Help with Scripts forum so you might see me there every now and then
see my profile to see what I'm up to I guess



over 2 stacks of posts

Some of my best projects can be found here: https://scratch.mit.edu/studios/27944298/

Happy Scratching!

Powered by DjangoBB