Sensing

Sensing

1. touching ()?

Determines whether the sprite touches the mouse pointer, edge of the stage, or another sprite

Example:

After you click the green flag, the sprite keeps moving and goes to the position (0,0) when it touches the edge. When you press the space key, it stops moving.

2. touching color ()?

Determines whether the sprite touches the specified color

Example:

Click the green flag and then kkeep pressing the → key. The sprite goes to the position (0,0) when it touches the color red.

Note: You need to draw some shapes or patterns in red on the backdrop or add a shape or pattern in red as a sprite.

3. color () is touching ()?

Determines whether the specified color touches another color

Example:

Click the green flag and then kkeep pressing the → key. The sprite goes to the position (0,0) when it touches the color red.

Note: You need to draw some shapes or patterns in red on the backdrop or add a shape or pattern in red as a sprite, and the color black is the color of the outline of the sprite.

4. distance to ()

Reports the distance between the sprite and the mouse pointer or another sprite

Example:

When you press the space key, the sprite says the distance between it and the mouse pointer.

5. ask () and wait

Asks the specified question and displays an input box for you to answer

Enter your answer and click the icon . Your answer is stored in the block answer.

Example:

When you press the space key, the sprite asks “What’s your name?” and wait for you to answer.

6. answer

Stores the last answer of ask () and wait

If no answer has been entered, it is empty.

Example:

When you press the space key, the sprite asks “What’s your name?” and wait for you to answer. Enter your name and click .

The sprite says “Hello” to you.

7. key () pressed?

Determines whether the specified key is pressed

Example:

When you click the green flag, the sprite says “Hello,” and when you press the space key, the sprite says “Nice to meet you!”

8. mouse down?

Determines whether the main button of the mouse is pressed

Example:

After you click the green flag, the sprite says “Yes” if you press the main button of your mouse.

9. mouse x

Reports the x-coordinate of the mouse pointer

Example:

After clicking the green flag, move your mouse. The sprite reports the x-coordinate of the mouse pointer in real time.

10. mouse y

Reports the y-coordinate of the mouse pointer

Example:

After clicking the green flag, move your mouse. The sprite reports the y-coordinate of the mouse pointer in real time.

11. set drag mode ()

Sets the drag mode of the sprite

Example:

When you click the green flag, the sprite is set to draggable.

Note: This block takes effect only when the stage is displayed in the full-screen mode.

12. loudness

Reports the current loudness

Example:

When you click the green flag, the sprite reports the current loudness.

13. timer

Reports the count value of the timer

Example:

When you press the key, the sprite starts to count the time, and when you press the space key, the counting stops.

14. reset timer

Resets the timer to zero

Example:

When you press the key, the sprite starts to count the time, and when you press the space key, the counting stops and the timer is reset to zero. When you press the key again, the time is counted from zero.

15. () of ()

Reports the specified value of the stage or a sprite

The options include the x- coordinate, y-coordinate, direction, costume number, costume name, size, and volume of a sprite, and the backdrop number, backdrop name, volume, and score of the stage.

Example:

When you press the space key, the sprite says its x-coordinate.

16. current ()

Reports information about the current time

Multiple time options are provided, including the year, month, date, day of week, hour, minute, and second.

Example:

When you press the space key, the sprite says “The year is 2020.”

17. days since

Reports the number of days passed since 2000

Example:

When you press the space key, the sprites says the number of days passed since 2000.