Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops 为什么可以';我不能把音乐停成一个循环吗?_Loops_Audio_Mit Scratch - Fatal编程技术网

Loops 为什么可以';我不能把音乐停成一个循环吗?

Loops 为什么可以';我不能把音乐停成一个循环吗?,loops,audio,mit-scratch,Loops,Audio,Mit Scratch,我正在制作一个游戏,我需要标题屏幕音乐。我添加了所有代码,它没有停止播放,只是重新启动音乐。我该如何解决这个问题 我曾尝试使用repeat-until块,但它仍然不起作用,它只是等待音乐结束后才停止 播放按钮代码: when this sprite clicked start sound coin broadcast game repeat 10 change ghost effect by 10 end of repeat block hide 背景代码: when i receiv

我正在制作一个游戏,我需要标题屏幕音乐。我添加了所有代码,它没有停止播放,只是重新启动音乐。我该如何解决这个问题

我曾尝试使用repeat-until块,但它仍然不起作用,它只是等待音乐结束后才停止

播放按钮代码:

when this sprite clicked
start sound coin
broadcast game
repeat 10
    change ghost effect by 10
end of repeat block
hide
背景代码:

when i receive game
repeat 10
    change ghost effect by 10
end of repeat block
switch backdrop to game

我希望输出停止标题屏幕音乐,但当前的输出是重新启动音乐,然后在完成后停止。

在音乐部分,有一个名为“停止所有声音”的块。


使用此块停止所有声音,但在停止所有声音之前添加0.3秒的延迟,以便它不会停止下面永久循环中的声音

您可能希望将代码更改为:

when backdrop switches to game
repeat 10
    change ghost effect by -10
end of repeat block
forever play sound music until done
stop all sounds
stop this script

停止所有声音将播放歌曲,停止此脚本将使循环停止

可以在
永远
永远执行后编码吗?那将违背“永远”一词的含义。不,它不能。这就是为什么
永久
块有一个没有任何连接器的底部边框。
when backdrop switches to game
repeat 10
    change ghost effect by -10
end of repeat block
forever play sound music until done
stop all sounds
stop this script