In Scratch, sensing blocks are blocks of code that allow your sprites (characters or objects in your program) to detect and respond to their environment. You can use sensing blocks to check the position of your sprites on the stage, the color of a pixel, or the distance to another sprite.
Here are some examples of sensing blocks in Scratch:
Sensing blocks are a powerful way to make your programs more interactive and responsive to their environment. You can use them to create games, animations, and other interactive programs in Scratch.
The block checks if its sprite is touching the mouse pointer, the edge, or another sprite. If the sprite touches the selected object, the block returns true; if not, it returns false.
The block checks if its sprite touches a specified color. If so, the block returns « true ».
The block checks if a color on its sprite touches another color. If so, the block returns « true ».
The block indicates the Euclidean distance, in pixels, between itself and the mouse pointer or the center of the costume of a specified sprite.
The block will display an input box (with the specified text above) at the bottom of the screen. Scrapers can enter text there and submit it, and the input is then stored in the Response block. The Response block automatically updates with the most recent entry.
Returns the most recent keystroke in the block. The variable is shared by all sprite objects (global).
The block checks if the specified key is pressed. If the key is pressed, the block returns « true »; if not, it returns « false ».
The block checks if the computer’s main mouse button is activated (clicked).
This block returns the abscissa x of the position of the mouse pointer.
This block returns the y ordinate of the mouse pointer position.
The block indicates the intensity of the noise received by a microphone, on a scale from 0 to 100. To use this block, a microphone must be used, and therefore a message will appear on the screen, asking permission to use the microphone . If you refuse it, the block will report a volume of 0 or -1.
The block starts at 0 when Scratch is launched and gradually increases; every second it will have increased by 1.
The block will report a specified value from the specified sprite or scene.
It reports either the local year, month, date, day of the week, hour, minutes, or seconds, depending on the argument. The block gets data based on the user’s computer clock set to a 24-hour clock.
It reports the number of days (and fractions of days) since 00:00:00 on January 1, 2000 (UTC).