Lesson 1 of 0
In Progress

Sensing Blocks

Using Sensing Blocks in Scratch
SCRATCH PROJECT

Using Sensing Blocks in Scratch

In Scratch, sprites can not only move and speak, but they can also sense things around them. The Sensing blocks help sprites detect actions such as touching another sprite, pressing a key, or moving the mouse.

Sensing blocks make projects interactive. They allow sprites to react to the user's actions or to other sprites on the stage.

Objective

  • Detect when a sprite is touched
  • Detect when a key is pressed
  • Make sprites respond to user actions
  • Create simple interaction using sensing

Project: Touch and Respond

1. Set the Scene

  1. Open Scratch and click on Create.
  2. Keep the default sprite or choose a new sprite.
  3. Add another sprite so that interaction can happen.
Set Scene

2. Add Movement to First Sprite

  1. Select the first sprite.
  2. Add When Green Flag Clicked from Events.
  3. Add a Forever block from Control.
  4. Inside it, add Move 5 steps and If on edge, bounce.

This will make the sprite move continuously.

Movement Sprite

3. Use Sensing Block

  • Go to the Sensing category (light blue color).
  • Drag the block Touching (sprite name)?
  • Place it inside an If block from Control.
Sensing Block

The Structure Should Be

Structure Example

4. Add Script to Second Sprite

  • Select the second sprite.
  • Add When I Receive (message1) block from Events.
  • Add a Say "Hi! Nice to meet you." for 2 seconds block.
  • Now the second sprite will respond when it receives the message.
Second Sprite

5. Test the Project

  • Click the Green Flag.
  • Let the moving sprite touch the second sprite.
  • Observe the message when they touch.
Test Project

Additional Sensing Examples

  • Using Key Pressed? block to move a sprite with arrow keys.
  • Using Mouse Down? to detect mouse clicks.
  • Using Ask and Wait block to take input from the user.
Additional Examples

What Students Learn

  • Broadcast sends messages between sprites.
  • “When I Receive” listens for messages.
  • Broadcast helps organize large projects.
  • It removes the need for long wait blocks.