Page 76 - 2616_V iCode_C-5
P. 76
Sensing Blocks
Sensing blocks in Scratch sense the input from the keyboard or the mouse at the time
of execution of a script. Some of the sensing blocks and their functions are given below:
block prompts the user to type the input using the
keyboard. It waits for the user input. No other block runs at that time.
block checks if the Sprite touches the mouse-pointer,
another Sprite or the edge. If the answer is true, then it executes the blocks given after
it in the condition. If false, then it executes other blocks as per the given condition.
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 colour 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 add sensing blocks to the script, follow the given steps:
1 Click on the Sensing
blocks category in tabs.
2 Insert a Sprite,
Penguin 2 on the
stage. Delete the cat
Sprite.
74 Premium Edition-V

