From Test-Scratch-Wiki

播放音效 ()
播放音效 [meow v]
类别 音效类积木
形狀 条形积木

The Play Sound () 积木 is a 音效类积木 and a 条形积木. The block will play the specified sound, with no pause to its 程式 (unlike the 播放音效 () 到底 block, which will pause its script until the sound has finished playing).

用法示例

As this block plays a sound without a delay in its script, it is mainly used when a sound must be played without bothering the script.

Some common uses for the Play Sound () block:

  • Playing a sound effect with an action
當 @greenflag 被點擊
播放音效 [meow v]
說出 [Hello!]
等待 (1) 秒
播放音效 [meow v]
說出 [Bye!]
等待 (1) 秒
  • If a 角色 has achieved a goal, a sound effect is played
當 @greenflag 被點擊
重複無限次 
  移動 (10) 點
  如果 <碰到 [邊緣 v] ?> 那麼 
    播放音效 [Victory v]
    碰到邊緣就反彈
  end
end
  • Enhancing an event
當 @greenflag 被點擊
重複無限次 
  如果 <碰到 [snowball v] ?> 那麼 
    播放音效 [collide v]
    等待直到 <<碰到 [snowball v] ?> 不成立>
  end
end

应用

Main article: List of Block Workarounds

The only other block that can play one of the pre-recorded sounds is the 播放音效 () 到底 block. This block, however, waits the length of the sound before continuing to the block below it so it has to be used with a broadcast before it in order to continue the script.

. . .
廣播訊息 [continue script v]
播放音效 [meow v] 到底

當收到訊息 [continue script v]
. . .

Notes

  • If a sound is playing and you play the same sound again, the sound will be cut off, but will play from the start again.
    • This does not happen if a different sound is played when a sound is currently playing.

参见

Cookies help us deliver our services. By using our services, you agree to our use of cookies.