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.