From Test-Scratch-Wiki

停止 ()
停止 [全部 v]
類別 控制類積木
形狀 平底形積木/條形積木(視添加的參數而定)
加入於 2.0

The Stop () 積木 is a 控制類積木. Depending on the argument, it is either a 平底形積木 (all or this 程式), or a 條形積木 (other scripts in 角色). It is the only block that changes its shape. It was added in Scratch 2.0 to replace the 停止全部 and 停止程式 blocks, and also to add the functionality of stopping other scripts in a sprite.

用法示例

Stopping other scripts in the sprite, as a 條形積木.

This block can be used in some of the following ways:

  • Ending a 專案 once all the actions are carried out
當收到訊息 [end v]
說出 [That's all folks!] (2) 秒
停止 [全部 v]
  • Stopping a project

— when all lives are lost, for example

當 @greenflag 被點擊
重複無限次 
  如果 <(lives) = [0]> 那麼 
    停止 [全部 v]
  end
end
  • Disabling controls
當 @greenflag 被點擊
重複無限次 
  如果 <<[向上 v] 鍵被按下?> 且 <(jumping) = [0]>> 那麼 
    變數 [delta-y v] 設為 [5]
  end
  如果 <(level) = [7]> 那麼 
    停止 [這個程式 v]
  end
end
  • Disabling a sprite
當 @greenflag 被點擊
重複無限次 
  如果 <(x座標) > [100]> 那麼 
    停止 [角色的其他程式 v]
    停止 [這個程式 v]
  end
end
  • Only performing an action a certain amount of times, and then stopping
當 @greenflag 被點擊
變數 [x v] 設為 [0]
重複無限次 
  如果 <(x) = [5]> 那麼 
    停止 [這個程式 v]
  end
  移動 (10) 點
  碰到邊緣就反彈
  變數 [x v] 改變 (1)
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.