The "Touching ( )" Block
-
Prerequisite
Description
The “Touching ()” block is a boolean block in the sensing category.
How the “Touching ( )” Block Works?
The “Touching ( )” block is used to check if the sprite is touching the “mouse-pointer”, the “Edge” of the Stage or any other “Sprite”.
If the Sprite is touching the selected object, the block gives “true” answer; if it is not touching the selected object, the block gives false.
Touching Mouse-pointer
If you select “mouse-pointer” as the target object, the touching block will check if the mouse is touching the sprite. For example, in this program, the dog will say true or false based on whether the mouse is touching it.
Touching Edge
If you select “edge” as the target object, the touching block will report whether the sprite is touching any of the 4 edges of the stage (highlighted in red).
Touching Sprite
If you select any other “sprite” as the target object, the touching block will check if it is touching the given sprite.
Note: You need to have at least two sprites in the project before you can select another sprite from the list.