Zmiany

Skocz do: nawigacji, wyszukiwania

Introduction 3 - Glossary of basic Scratch 2.0 blocks

Dodane 2900 bajtów, 09:09, 7 lip 2015
/* Operators */
[[Plik:M_3_1.JPG|center]]
The category '''Motion ''' groups sprite movement blocks, used for their movement, rotation and reading current data related to a sprite’s location. These are very often used basic blocks. Below is a description of all the blocks in this category.
[[Plik:M_3_2.JPG]]
[[Plik:M_3_24.JPG|center]]
The '''Looks ''' category is a collection of sprite appearance blocks concerning costume, size, visibility, etc. Some of these blocks are used very often. Below is a description of most blocks in this category.
[[Plik:M_3_25.JPG]]
For a limited time displays in a speech bubble the text shown in the edit box. This means stopping the script execution for a specified number of seconds. A variable can also be dragged into the edit box or an expression can be built in it – often to connect the displayed information we use the '''join ''' block.
'''Example:'''
[[Plik:M_3_26.JPG]]
Displays in a speech bubble the text shown in the edit box and does not stop the script execution. Consequently, further instructions are executed, which might cause the bubble’s quick disappearance. A variable can also dragged into the edit box or an expression can be built in it – often to connect the displayed information we use the '''join ''' block.
'''Example:'''
[[Plik:M_3_27.JPG]]
For a limited time displays in a thought bubble the text shown in the edit box. This means stopping the script execution for a specified number of seconds. It works in the same way as the '''say ''' command, but a different kind of information is displayed. A variable can also be dragged into the edit box or an expression can be built in it – often to connect the displayed information we use the '''join ''' block.
'''Example:'''
[[Plik:M_3_28.JPG]]
Displays in a thought bubble the text shown in the edit box and does not stop the script execution. Consequently, further instructions are executed, which might cause the information’s quick disappearance. It works in the same way as the '''say ''' command, it is just a different kind of bubble. A variable can also be dragged into the edit box or an expression can be built in it – often to connect the displayed information we use the '''join ''' block.
'''Example:'''
[[Plik:M_3_39.JPG]]
Name of the currently displayed background. It can be used as an argument in expressions.
Checking the checkbox on the left displays the background name on the stage.
[[Plik:M_3_45.JPG]]
Stops all currently played sounds.
==Pen==
[[Plik:M_3_76.JPG]]
This block allows us to define and broadcast a message. We can choose the message name from the drop-down list or define a new message using the '''new message... ''' option available when we expand the list.
[[Plik:M_3_77.JPG]]
[[Plik:M_3_109.JPG]]
The blocks used to build complex logical expressions (conjunction – both conditions are true, alternative – one of the conditions is true, negation – contradiction). Insert the matching blocks returning Boolean values (true or false) in argument boxes. Blocks are used most often in the following instructions: '''if, repeat until, wait until'''.
'''Example:'''
 
[[Plik:M_3_110.JPG]]
 
The block is used to connect two strings of text into one. Usually one of the arguments is the entered text, and the other a value returned by another block. The block is often used as an argument in the '''say''' and '''think''' blocks.
 
'''Example:'''
 
[[Plik:M_3_111.JPG]]
 
The value is the remainder of the division of the first argument by the second. The block is often used as an argument in arithmetic and logical operations.
 
'''Example:'''
 
[[Plik:M_3_112.JPG]]
 
The value is the argument rounded off to the nearest integer – according to rounding rules, i.e. 0.5 and more is rounded up, otherwise down. The block is often used as an argument in other blocks.
 
'''Example:'''
 
[[Plik:M_3_113.JPG]]
 
The value is the result of the function selected from the drop-down list for the argument specified in the edit box. From the drop-down list we can select the following functions:
[[Plik:M_3_114.JPG]]
 
The block is often used as an argument in other blocks. Functions such as '''floor''' (always round down) and '''ceiling''' (always round up) may require explanation.
 
'''Example:'''
 
[[Plik:M_3_115.JPG]]
 
==Stage blocks==
 
[[Plik:M_3_116.JPG|center]]
 
The stage, like sprites, can have its own scripts. To create scripts for the stage we need to select it as the active object in the bottom right corner of the screen – the area for managing sprites and the stage. The choice of available blocks will change then – many of them apply only to sprites and may not be used in stage scripts. Differences are described below.
 
1. The '''Motion''' category
 
There is no block in this category, the stage cannot be moved or rotated.
 
 
2. The '''Looks''' category
Most changes are in this category. The stage can have multiple backgrounds, just like a sprite can have multiple costumes. There are blocks associated with the change of background and information about the selected background. The most important of these are the following:
 
[[Plik:M_3_117.JPG]]
 
 
3. The '''Sounds''' category
The blocks are the same, but when we play audio files they relate to the sounds assigned to the stage in the '''Sounds''' tab.
 
4. The '''Pen''' category
In this category, there is only one block for the stage – '''clear'''.
 
 
5. The '''Data''' category
 
The same as for sprites. The only difference is that we can only create variables available for all sprites.
 
 
6. The '''Events''' category
The same blocks as for sprites.
 
7. The '''Control''' category
The same blocks as for sprites.
 
8. The '''Sensing''' category
 
The same blocks as for sprites. There are no blocks for sprites interacting with other objects and colours ('''is touching, is touching the colour, the colour is touching the colour, distance from''')
 
9. The category '''Events'''
 
The same blocks as for sprites.
223
edycje