|Note:||Click on a block to learn more about it!|
Scratch 2.0 has the following 1 Stack block in More Blocks:
Blocks added through Scratch Extensions also appear in this category.
Uses of Custom Blocks
Custom blocks are useful in many programming situations, such as the following:
- reduced project file space
- running a script without screen refresh
- organization of scripts instead of duplicating large scripts with minor edits
Custom blocks allow for number, string, and Boolean inputs to be inserted into the definition and title, which the input of can be edited in the stack block. For example, if you have a number input inserted into a custom block's definition, you can run the custom procedure entering any number into the custom stack block, and that number will be rendered as all the number inputs in the definition. This easy input insertion method allows a project to perform large, customizable scripts without having to duplicate the scripts, edit a few blocks, and waste file space. This block is used because if you have a bunchload of scripts, and you need to repeat them a bunchload of times, more blocks saves time for that. Also, there is a button called 'Run without screen refresh' which can be used to make things happen faster.
Using custom blocks is the only way to run scripts without screen refresh. Screen refresh is the very miniscule wait between each block in a script. When creating the title of a custom block, there is an edit menu with the input insertions and also a checkbox that allows you to disable screen refresh. By default it is enabled. When the box is checked and the custom block runs, it will perform in an instant, which can be beneficial for setting up a particular scene in a project or performing large mathematical calculations, possibly in a game with artificial intelligence.
Also, when making a new block, you may notice an options section under the block that you have created:  This block is used because if you have a bunchload of scripts, and you need to repeat them a bunchload of times, more blocks saves time for that. Also, there is a button called 'Run without screen refresh' which can be used to make things happen faster.
The workaround for custom blocks does not allow features such as inputs, for they would require variables, or disabling screen refresh, but it works well for basic scripts. It uses a broadcasting method instead of a procedure. When the broadcast is received, in a way the sprite or stage performs its own procedure.
when gf clicked broadcast [jump v] and wait
when I receive [jump v] repeat (5) change y by (6) end repeat (5) change y by (-6) end
|Main Block Categories|
|Other Block Categories|