One of the most fun things in scratch is Sensing. This means being able to detect when one sprite makes contact with something else, for example, another sprite. Once you have finished this tutorial you will have the skills to begin planning the design of your first basic game!
In this tutorial:
Required knowledge:
Starting point
The final code from the Walk the dinosaur tutorial (first image below) is your starting point.

- We need to remove the and code block and all its conditions.
- Hover just above the and and left-click grab.

- Drag the entire and code block out of the code.
- Right-click on the block.
- Select Delete 5 blocks.
Add the Rocks sprite

- Click on the Choose a Sprite button in the Sprite panel.
- Search for and add the Rocks sprite.

- The Rocks sprite is now present on the stage.
- Drag it into position on the stage or set the 𝚡 & 𝚢 coordinates in the Sprite settings panel.
- The Rocks sprite must be in the path of the dinosaur.
Add a Sensing code block

- Add the
touching ... ?
code block from the Sensing category. - Select the Rocks sprite from the dropdown of the
touching ... ?
code block.

- Add a
say ... for ... seconds
code block. - Type Ouch! into the first input and 2 into the second input.
Run

- Click the dinosaur sprite.
- When the dinosaur sprite hits the rock, it stops and exclaims “Ouch!”.
- The message disappears after 2 seconds.
Next steps
What happens if you want the second sprite to react to being hit by the first sprite? We will need to Broadcast & Receive messages in Scratch.