(Redirected from Flag (programming feature))
The Green Flag is a programming feature that, when clicked, will start all scripts in that project that are hatted with the When Green Flag Clicked block. More simply, this block starts the project. Offline, pressing the key on a keyboard will also start all green flag scripts, when not prompted for input by the Ask () and wait block. Also, when clicking the green flag, Turbo Mode will be activated, and clicking will mute the project so that the project cannot produce any sound ( click on a Mac). Commonly on large-asset projects, you will be asked to 'double-click' the flag. It is known to reduce lag during a game or ensure that some things happen, such as a sprite showing. This is because double-clicking runs the flag sprites multiple times, so it is less likely to have something not happen.
when gf clicked
Examples of projects which do not use the Green Flag block are:
- Projects which just share an image
- Slide shows where only key presses need to be used to move the images
- Main article: Stop Sign
The Stop Sign is the opposite of the flag; a project will end and fully stop all scripts when it is clicked or the Stop () block is used with the "all" option.
In Scratch 1.4 and the online Java player, by broadcasting
scratch-startclicked the flag was activated, meaning a project can start if a sprite is clicked.
Conversely, a broadcast received block Hat Block with the broadcast
scratch-startclicked activates when the green flag is pressed.
Custom Block Insertion
|This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.|
In older versions of Scratch 2.0, the Green Flag icon could be placed into custom blocks and variables by adding the text "@greenFlag" to the custom block name.
A similar trick could be done with the stop sign by adding the text "@stop" to a custom block.
Some users will request you to "double-click" the green flag before playing, in the instructions of their project. This improves the quality of the game, and removes bugs. Double-clicking makes sure that everything is reset and every When Green Flag Clicked Block is running, as in Scratch 2.0, sometimes not everything started when the green flag was clicked. This was fixed in Scratch 3.0.
- ar-topic:57153 Known Limitation 3