4.1 Sensing blocks

View

Sensing blocks are light blue in colour and are used to detect different factors of a project. Sensing blocks are one of the eight categories of Scratch blocks.  Sensing block is used to sense when a certain event is happening and display any other instruction.  For example, it would make a sprite say “You’re touching the edge” when the sprite touches the edge.

There are different elements of sensing blocks and each element has its own functionality.  The table below shows…

 

Sensing Block

What it does

The block checks if its sprite is touching the mouse-pointer, edge, or another sprite. If the sprite is touching the selected object, the block returns true; if it is not, it returns false.

The block checks whether its sprite is touching a specified color. If it is, the block returns "true".

The block checks whether a color on its sprite is touching another color. If it is, the block returns "true".

The block reports the Euclidean distance, in pixels, between it and the mouse-pointer or a specified sprite's costume centre.

The block will make an input box (with the specified text above it) show at the bottom of the screen. Scratchers can input text into it and submit it, and the input is then stored in the Answer block. The Answer block automatically updates to most recent input.

The block holds the most recent text inputted with the Ask () and Wait block. When nothing has been inputted yet, the value will hold nothing.

The block checks to see if the specified key is pressed. If the key is being pressed, the block returns "true"; if it is not, it returns "false".

The block checks if the computer mouse's primary button is activated (being clicked).

The block holds (reports) the mouse-pointer's current Mouse X.

The block holds the mouse-pointer's current Mouse Y.

The block allows the setting on which element that can be dragged or not dragged.

The block reports how loud the noise is that a microphone receives, on a scale of 0 to 100. To use this block, a microphone must be used, and so a message will appear on the screen, asking for permission to use the microphone. If you deny it, the block will report a loudness of 0 or -1.

The block starts at 0 when Scratch is launched and increases gradually; every second it will have increased by 1.

The block sets the timer's value back to 0.0. When this block is present, the project typically utilizes the Timer output block; usually the timer must be reset at the beginning of a project for the Timer block to hold the right value.

The block will report a specified value of the specified sprite or the Stage.

It reports either the current local year, month, date, day of the week, hour, minutes, or seconds, depending on the argument. The block gets the data based on the user's computer's clock and sets at a 24-hour clock.

 

It reports the number of days (and fractions of a day) since 00:00:00 1 January 2000 (UTC).

Display the account holder’s username

Table 9: Sensing blocks 

 

The sensing blocks allow user inputs and can make the animation change or adjust itself according to that user input. The block senses when the user has entered data. User input can be the click of the mouse, using the arrow keys on the keyboard to make a sprite move around the stage, or when a user types an answer into a question box. The sensing blocks allow the program to sense when a user input happens and how to respond to that input.  


Last modified: Wednesday, 29 September 2021, 4:29 PM