7. Sensing

Sensing code blocks allow your program, sprites and objects to sense the stage.

7.1. Touching

_images/00-touching-mouse-pointer.png

This code block detects when something is touching the mouse pointer.

_images/00-touching-edge.png

This code block detects when something is touching the edge.

_images/01-touching-color.png

This code block detects when something is touching a specified color.

_images/02-color-x-touching-color-y.png

This code block detects when two specified colors are touching.

Code

7.2. Distance

_images/03-distance-to-mouse-pointer.png

This code block detects the distance to the specified object (for example, mouse pointer).

Code

7.3. Asking

You may get input from users.

_images/04-ask-name-wait.png

This code block asks the user for input.

Code

7.4. Keys

_images/05-key-space-pressed.png

This code block senses when the space bar is pressed.

_images/06-key-up-pressed.png

This code block senses when the up arrow is pressed.

_images/07-key-down-pressed.png

This code block senses when the down arrow is pressed.

_images/08-key-right-pressed.png

This code block senses when the right arrow is pressed.

_images/09-key-left-pressed.png

This code block senses when the left arrow is pressed.

Code

7.5. Mouse

_images/10-mouse-down.png

This code block senses if the mouse is pressed down.

_images/11-mouse-x.png

This code block senses the x coordinate of the mouse.

_images/12-mouse-y.png

This code block senses the y coordinate of the mouse.

Code

7.6. Drag

_images/19-set-drag-mode.png

This code block sets the drag mode.

7.7. Timer

_images/13-reset-timer.png

This code block resets the timer.

Code

7.8. Stage

_images/14-backdrop-number-stage.png

This code block senses the backdrop of the stage. For example, is it the first, second, third, and so on backdrop?

_images/15-backdrop-name-stage.png

This code block senses the backdrop name of the stage.

_images/16-volume-stage.png

This code block senses the volume of the stage.

_images/17-my-variable-stage.png

This code block senses the specified variable of the stage.

Code

7.9. Days

_images/18-days-since-2000.png

This code block senses the number of days since the year 2000.