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

#1 2013-01-06 15:44:34

LFOB
Scratcher
Registered: 2010-06-11
Posts: 90

Music Loops

Well, I'm making an RPG for a Scratch Day 2013 competition, and I'm using some free short music-loops.
They loop, I have a whole system for them set up, everything is fine, but there's one problem; when I try to switch from the title screen to the intro, it keeps playing the first song until the loop is done, then plays the next. I understand that this is because of the scripts saying so, but I'm not sure how I'm supposed to change them so they'll stop.
SCRIPTS I USED:

when gf clicked
forever
 if <(Scene) = [1]>
 stop all sounds
 play sound [Title Screen] until done
end
 if <(Scene) = [2]>
 stop all sounds
 play sound [Intro] until done
end
AND

when gf clicked
forever
if <(Scene) = [1]>
 stop all sounds
 reset timer 
 play sound [Title Screen]
 wait until <(timer) = [14]>
end
if <(Scene) = [2]>
 stop all sounds
 reset timer 
 play sound [Intro]
 wait until <(timer) = [126]>
end


http://scratch.mit.edu/static/projects/LFOB/2413118_med.png  http://scratch.mit.edu/static/projects/LFOB/2255829_med.png

Offline

 

#2 2013-01-06 16:16:50

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Music Loops

when i receive [title screen v]
set [scene v] to [1]
stop all sounds
repeat until <(scene) = (2)>
play sound [title screen v] until done
end

when i receive [intro v]
set [scene v] to [2]
stop all sounds
repeat until <(scene) = (1)>
play sound [intro v] until done
end

Last edited by joefarebrother (2013-01-06 16:17:47)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#3 2013-01-06 16:34:29

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Music Loops

What you need to do is put your "stop all sounds" blocks into a new script, because they can't activate while a sound block is playing.

So include a script like this and it should work:
http://i49.tinypic.com/mc3yfr.gif


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#4 2013-01-06 16:54:04

curiouscrab
Scratcher
Registered: 2012-06-25
Posts: 100+

Re: Music Loops

Kileymeister wrote:

What you need to do is put your "stop all sounds" blocks into a new script, because they can't activate while a sound block is playing.

So include a script like this and it should work:
http://i49.tinypic.com/mc3yfr.gif

You may want to add a wait block. Also, just use scratchblocks next time using the [scratch!blocks] (no ! sign) tags.


http://i50.tinypic.com/dopbtw.png

Offline

 

#5 2013-01-06 17:24:41

LFOB
Scratcher
Registered: 2010-06-11
Posts: 90

Re: Music Loops

Kileymeister wrote:

What you need to do is put your "stop all sounds" blocks into a new script, because they can't activate while a sound block is playing.

So include a script like this and it should work:
http://i49.tinypic.com/mc3yfr.gif

Thanks, that works!


http://scratch.mit.edu/static/projects/LFOB/2413118_med.png  http://scratch.mit.edu/static/projects/LFOB/2255829_med.png

Offline

 

Board footer