Page 131 - TGPT_V5.0_C5_Flipbook
P. 131
block checks if the sprite is touching the colour chosen in the block. If true,
then it executes a set of blocks, else executes another set of blocks.
The block checks if the first chosen color is touching the second chosen
colour. If true, then it executes a set of blocks, else executes another set of blocks.
block checks if the chosen key is pressed by the user. If true, then it
executes a set of blocks, else executes another set of blocks.
Let us create a small script to understand the working of sensing blocks.
Sensing an Input
To use sensing blocks in a script, follow the given steps:
1 Click on the Sensing
block category.
Insert Penguin2
sprite on the 2
stage.
3
Delete the cat sprite.
5 Drag the ask block to the Add Arctic backdrop 4
script area and click on it. to the stage.
Type your name and
click on the tick button 6
or press the Enter key.
When you type the name and click on the tick button or press the Enter key, the sprite does
not show your name. It can be done by placing the answer block in a say block.
Conditional Blocks in Scratch 129

