skip to content
Introduction to Coding

Introduction to Sensing Blocks

Lesson on Sensing Commands

In this lesson, we will learn about sensing commands with the help of Raj and Arun.

Raj: Hello Arun. You told me that next time we will learn about sensing commands.

Arun: Yes! Sensing commands detect various things. Let’s start with the three Sensing Stack blocks.

Arun: The [ask [What’s your name?] and wait] block shows an input box to type a value that stores in the answer variable.

Arun: The [reset timer] block resets the timer.

Arun: The [set drag mode [draggable v]] block sets the sprite to draggable or not draggable.

Raj: Interesting! What about Boolean blocks?

Arun: There are five Sensing Boolean blocks.

Arun: The [touching [mouse-pointer v]] block checks if the sprite is touching the mouse-pointer or another sprite.

Arun: The touching color [] block checks if the sprite is touching a specific color.

Arun: The color [] is touching [] block checks if a color on the sprite is touching a specific color.

Arun: The [key [space v] pressed?] block checks if the specified key is being pressed.

Arun: The [mouse down?] block checks if the mouse button is down.

Raj: Got it! What about the Reporter blocks?

Arun: There are ten Sensing Reporter blocks.

Arun: The [distance to [mouse-pointer v]] block reports the distance from the sprite to the mouse-pointer or another sprite.

Arun: The [answer] block reports the most recent input with the [ask [What’s your name?] and wait] block.

Arun: The [mouse x] block reports the mouse-pointer’s X position.

Arun: The [mouse y] block reports the mouse-pointer’s Y position.

Arun: The [loudness] block reports how loud the noise is that the microphone is sensing.

Arun: The [timer] block reports how much time has passed since the Scratch program was opened or the timer reset.

Arun: The [([x position v] of [Sprite1 v])] block reports the X position, Y position, direction, costume, size, or volume of the stage or a sprite.

Arun: The [current [year v]] block reports the specified time unit selected.

Arun: The [days since 2000] block reports the number of days since 2000.

Arun: The [username] block reports the username of the user.

Raj: These blocks are amazing! Now we can detect various things in our project.

Arun: Yes! That’s all for this lesson. Next, we will discuss how to use these sensing commands with conditions and loops.

Raj: Looking forward to it!