From Test-Scratch-Wiki
Stop () | |
![]() | |
Category | Control |
Type | Cap/Stack (changes depending on argument) |
Introduced in | 2.0 |
The Stop () block is a Control block. Depending on the argument, it is either a Cap block (all or this script), or a Stack block (other scripts in sprite). It is the only block that changes its shape. It was added in Scratch 2.0 to replace the Stop All and Stop Script blocks, and also to add the functionality of stopping other scripts in a sprite.
Example Uses
This block can be used in some of the following ways:
- Ending a project once all the actions are carried out
when I receive [end v] say [That's all folks!] for (2) secs stop [all v]
- Stopping a project
— when all lives are lost, for example
when gf clicked forever if < (lives) = [0] > then stop [all v] end
- Disabling controls
when gf clicked forever if << key [up arrow v] pressed? > and < (jumping) = [0] > > then set [delta-y v] to [5] end if < (level) = [7] > then stop [this script v] end
- Disabling a sprite
when gf clicked forever if < (x position) > [100] > then stop [other scripts in sprite v] stop [this script v] end
- Only performing an action once, and then stopping
when gf clicked set [x v] to [0] forever if < (x) = [1] > then stop [this script v] end move (10) steps if on edge, bounce change [x v] by (1)