Page 85 - ConceptGP_C5_Fb
P. 85
CONTROLLING THE MOVEMENT OF A SPRITE
We can control a Sprite by using the sensing block.
SENSING BLOCK
The Sensing block gives an answer when asked a question. Sensing blocks are
colour-coded with a light-blue shade and are used to detect different sprites and
elements of a project including the edge of the stage. They control the movement of the
sprite in a better manner. The table given below outlines the code blocks that fit into this
category:
Blocks Functions
Checks if its sprite is touching the mouse-pointer, the edge,
or another sprite. If the sprite is touching the selected object,
touching mouse-pointer ?
the block returns a true value; if it is not, it returns ‘false’. It is
used with an if-then block.
Checks whether its sprite is touching a specified colour. If it
touching color ?
is, the block returns ‘true’. It is used with an if-then block.
Makes an input box (with the specified text above it) and
displays it at the bottom of the screen. The user can then
ask What’s your name? and wait
enter text into it and submit it. The input is stored in an
Answer block after that.
Holds the most recent text entered with the Ask () and Wait
answer
block.
Checks if the specified key is pressed. If the key is being
key space pressed?
pressed, the block returns ‘true’; if it is not, it returns ‘false’.
Let us create a program and hear your cat meow.
Step 1 Click the Event button to show the Event blocks. when clicked
Step 2 Click the Motion button to show the Motion blocks. move 100 steps
Step 3 Drag a Move 10 steps block to the code area and change the
value to 100.
Step 4 Click the Control Button to show the Control blocks. if then
Step 5 Drag an if…then block to the code area.
More on Scratch 83

