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

#1 2013-01-28 20:01:58

Jaydeeizsik
New Scratcher
Registered: 2013-01-06
Posts: 5

Background Music Clash

Hey Scratchers,

I'm currently working on a role playing game and so far it's been great. Except for one minor issue that is.

You see, I've made a sprite that plays music. When you click on it, it plays a 2 and a half minute song until it ends. A little while back, I decided to add some background music to the game. It sounded awesome, and I tried to make the scripts different so that when I played the music on the stereo sprite, the background music would stop so it didn't clash with the music that was playing from the stereo, if you know what I mean. Anyway, that failed, and whenever I tried to play music, the background music would play too.

So I was wandering if anyone could help me with this. All I need to know is a scripting process that stops the background music when I click on the sprite and play the song, and then automatically resume the background music again once the song finishes (you can use the stereo over and over again by the way).

I'd appreciate the help guys!

Offline

 

#2 2013-01-28 20:52:37

OverPowered
Scratcher
Registered: 2012-07-27
Posts: 100+

Re: Background Music Clash

You could try something like this:

when gf clicked
set [Music v] to (BackgroundMusicName)
forever
play sound (Music) until done
set [Music v] to (BackgroundMusicName)
end

when [MusicPlayingSprite] clicked
set [Music v] to (ExtraMusicName)
stop all sounds
This should make the music play just once, then stop.  smile


Newest project: Tunnel TEST ~http://blocks.scratchr.org/API.php?user=OverPowered&action=onlineStatus~ On my mind: Unicameralism

Offline

 

#3 2013-01-29 01:22:44

mrn0body
Scratcher
Registered: 2012-12-11
Posts: 37

Re: Background Music Clash

OverPowered wrote:

You could try something like this:

when gf clicked
set [Music v] to [BackgroundMusicName]
forever
play sound (Music) until done
set [Music v] to [BackgroundMusicName]
end

when [MusicPlayingSprite] clicked
set [Music v] to [ExtraMusicName]
stop all sounds
This should make the music play just once, then stop.  smile

Fixed  smile


Why Fit In When You Were Born To Stand Out

Offline

 

Board footer