π Module 3: Sound, Events & User Interaction in Scratch
βMaking your projects respond to clicks, keys, and sounds.β
π Module Introduction
In Modules 1 and 2, we learned how to make sprites move and change their appearance. But a good project also needs to respond to the user and include sound.
Think of a video game β when you press a key, something happens. When you click on a character, it speaks. That's user interaction. Sound adds excitement β music, sound effects, and voice.
In this module, we will learn how to use event blocks to trigger actions, sound blocks to add audio, and sensing blocks to interact with the user. Let's make your projects interactive!
π― Learning Objectives
- Use event blocks to start code (green flag, key press, sprite click).
- Add sounds and music to your projects.
- Make sprites respond to user clicks and keyboard presses.
- Use sensing blocks to detect mouse position and touching.
- Create interactive stories and games.
π Warm-up Story: The Interactive Game
Imagine you are creating a game where a lion sprite appears on the stage. When the player clicks on the lion, it roars and moves to a new position.
You use an event block: "when this sprite clicked". You add a sound block: "start sound roar". You add a motion block: "glide to random position".
Now you have a fun, interactive game. Players love clicking on the lion to hear it roar. This is the power of events, sound, and interaction!
π Main Lessons
Lesson 1: What Are Events?
Definition: Events are blocks that trigger your code to run.
Why important: Without events, your code would never start.
Simple explanation: It's like starting a race β the green flag is the starting signal.
Common event blocks:
- When green flag clicked: Starts when you click the flag.
- When this sprite clicked: Runs when you click the sprite.
- When key pressed: Runs when you press a key.
- When backdrop switches to: Runs when the backdrop changes.
Nigerian example: A game starts when the green flag is clicked.
Events = Triggers:
βββββββββββββββββββββββββββββββββββββββββββββββ
β Green flag clicked β Start the game β
β Sprite clicked β Make it speak β
β Key pressed β Move the sprite β
βββββββββββββββββββββββββββββββββββββββββββββββ
β
Mini summary: Events start your code.
Lesson 2: When Green Flag Clicked β The Main Start
Definition: The most common event β starts your project when you click the green flag.
Why important: Almost every project uses this block.
How to use:
- Drag the "when green flag clicked" block from Events to the scripts area.
- Add blocks below it to run when the flag is clicked.
Nigerian example: A story starts when the green flag is clicked.
β
Mini summary: Green flag clicked starts your project.
Lesson 3: When This Sprite Clicked β Click Interaction
Definition: This event runs when you click on a specific sprite.
Why important: It makes your sprites interactive.
How to use:
- Select a sprite.
- Drag "when this sprite clicked" to the scripts area.
- Add blocks below it β like "say Hello" or "move 10 steps".
Nigerian example: A character says "Hello!" when clicked.
β
Mini summary: Sprite clicked makes sprites respond to clicks.
Lesson 4: When Key Pressed β Keyboard Interaction
Definition: This event runs when a key on the keyboard is pressed.
Why important: It lets you control sprites with the keyboard.
How to use:
- Drag "when key pressed" from Events.
- Choose a key from the dropdown (e.g., space, up arrow).
- Add blocks below it.
Nigerian example: Pressing the space bar makes a character jump.
β
Mini summary: Key pressed lets you control with the keyboard.
Lesson 5: Sound β Adding Audio
Definition: Sound blocks add music, sound effects, and voice to your project.
Why important: Sound makes your project more engaging.
Common sound blocks:
- start sound: Plays a sound.
- play sound until done: Plays the whole sound.
- change volume: Adjusts loudness.
- set volume to: Sets the volume.
Nigerian example: A game plays a drum sound when you score.
β
Mini summary: Sound blocks add audio to your projects.
Lesson 6: Choosing Sounds from the Library
Why important: Scratch has a library of sounds you can use.
How to choose:
- Click the "Sounds" tab.
- Click "Choose a Sound".
- Browse and click on a sound to add it.
Nigerian example: A game uses a "clap" sound from the library.
β
Mini summary: Scratch has a free sound library.
Lesson 7: Recording Your Own Sounds
Why important: You can record your own voice or sounds.
How to record:
- Click the "Sounds" tab.
- Click "Record".
- Click the record button and speak.
- Click stop and save.
Nigerian example: A student records "Welcome to Nigeria!"
β
Mini summary: You can record your own sounds.
Lesson 8: Sensing β Detecting Things
Definition: Sensing blocks detect things like mouse position, key presses, and touching.
Why important: Sensing makes your projects interactive.
Common sensing blocks:
- touching mouse-pointer? β Checks if touching the mouse.
- touching color? β Checks if touching a color.
- mouse x and y: β Gets mouse position.
- ask and wait: β Asks the user a question.
Nigerian example: A game checks if the mouse is touching the character.
β
Mini summary: Sensing blocks detect interactions.
Lesson 9: Ask and Wait β Getting User Input
Definition: This block asks the user a question and waits for an answer.
Why important: It lets you create quizzes and interactive stories.
How to use:
- Add "ask What is your name? and wait".
- The answer is stored in the "answer" reporter.
- You can use the answer in a "say" block.
Nigerian example: A quiz asks "What is the capital of Nigeria?"
β
Mini summary: Ask and wait gets user input.
Lesson 10: Making an Interactive Story
Why important: Stories are more engaging when users can interact.
Steps:
- Add a sprite and backdrop.
- Use "when green flag clicked" to start.
- Add "say" blocks to tell the story.
- Add "ask" blocks to get user input.
- Use "if" blocks to respond differently.
Nigerian example: A story about Lagos where the user chooses what happens next.
β
Mini summary: Interactive stories respond to user choices.
Lesson 11: Creating a Simple Game β Click the Sprite
Why important: Games are the most popular Scratch projects.
Steps:
- Choose a sprite.
- Add "when this sprite clicked".
- Add "start sound" to play a sound.
- Add "change score" to increase score.
- Add "glide to random position" to move the sprite.
Nigerian example: A game where you click on a lion to score points.
β
Mini summary: Click the sprite game β click, score, and move.
π Key Vocabulary
Event β A trigger for code.
Green flag β Starts your project.
Key pressed β Keyboard trigger.
Sprite clicked β Click trigger.
Sound β Audio blocks.
Sensing β Detecting things.
Interaction β Responding to user.
Ask β Getting user input.
Answer β The user's response.
Game β An interactive project.
π§ Important Concepts
- Events start everything: No code runs without an event.
- Interaction makes it fun: Users love clicking and pressing keys.
- Sound adds excitement: Music and effects make projects better.
π’ Steps to Perform Key Tasks
Task 1: Add a Sound to a Sprite
- Select a sprite.
- Click the "Sounds" tab.
- Choose a sound from the library.
- Add "when green flag clicked".
- Add "start sound" and choose your sound.
- Click the green flag to hear it.
Task 2: Make a Sprite Respond to a Click
- Select a sprite.
- Add "when this sprite clicked".
- Add "say Hello" below it.
- Click the sprite to see the speech bubble.
Task 3: Make a Sprite Move with the Keyboard
- Select a sprite.
- Add "when key pressed" and choose "space".
- Add "move 10 steps" below it.
- Press the space bar to move the sprite.
β
Mini summary: Follow these steps to add sound and interaction.
π’ Step-by-step: Creating a Clicker Game
- Open Scratch β start a new project.
- Choose a sprite β pick one you like.
- Create a variable called "score" β from Variables.
- Add "when this sprite clicked" β from Events.
- Add "change score by 1" β from Variables.
- Add "start sound" β choose a sound.
- Add "glide 0.5 secs to random position" β from Motion.
- Test your game β click the sprite to score.
π§Έ Fun Examples for Children
- Pet game: Click on a pet to hear it make a sound.
- Keyboard game: Press keys to make a character move.
π Everyday Examples
- Family story: Create a story where family members click to speak.
- School quiz: Make a quiz that asks questions and checks answers.
πͺ Parent Tips
- Help your child add sounds β it makes projects more fun.
- Encourage them to create interactive stories.
- Show them how to record their own voice.
π‘ Interesting Facts
- Scratch has over 100 built-in sounds.
- You can use Scratch to make music.
- Interactive projects get more views on the Scratch website.
β Did You Know?
- You can play sounds at the same time.
- You can change the volume of sounds.
π Remember This
- Events start your code.
- Green flag is the main start.
- Sprite click and key press are for interaction.
- Sound adds excitement.
- Sensing detects things like mouse and touching.
- Ask gets user input.
β οΈ Common Mistakes
- Forgetting the event block. β Always start with an event.
- Not testing sounds. β Make sure your sound is loaded.
- Using the wrong key. β Check which key you selected.
- Not using the answer. β Use the answer from "ask".
β
Best Practices
- Always start with an event block.
- Test your sounds β make sure they work.
- Use clear keys for controls.
- Use "ask" for user input.
- Add sound effects for feedback.
π Comparison: Event Blocks
| Event | When It Runs | Use |
| Green flag clicked | When you click the flag | Start the project |
| Sprite clicked | When you click the sprite | Sprite interaction |
| Key pressed | When you press a key | Keyboard control |
| Backdrop switches | When backdrop changes | Scene changes |
π End-of-Module Summary
Great work! You have learned how to make interactive projects:
- Events: Green flag, sprite click, key press.
- Sound: Add music and effects.
- Sensing: Detect mouse, touching, and keyboard.
- Ask: Get user input.
- Interactive stories: Respond to user choices.
- Games: Clicker games with score and sound.
Your projects are now interactive and engaging!
β Frequently Asked Questions
- Q1: What is an event?
A trigger that starts your code.
- Q2: How do I add a sound?
Click the Sounds tab and choose a sound.
- Q3: How do I make a sprite respond to a click?
Use "when this sprite clicked".
- Q4: How do I make a sprite move with the keyboard?
Use "when key pressed" and add motion blocks.
- Q5: What is sensing?
Detecting things like mouse and touching.
- Q6: How do I ask a question?
Use "ask and wait".
- Q7: Where is the answer stored?
In the "answer" block.
- Q8: Can I record my own sound?
Yes β click "Record" in the Sounds tab.
- Q9: What is a clicker game?
A game where you click to score points.
- Q10: Why is sound important?
It makes projects more exciting.
π Matching Exercise
Match the event with its trigger.
| Event | Trigger |
| 1. Green flag clicked | A. Pressing a key |
| 2. Sprite clicked | B. Clicking the flag |
| 3. Key pressed | C. Clicking the sprite |
| 4. Backdrop switches | D. Changing the background |
(Answers: 1-B, 2-C, 3-A, 4-D)
π Scenario-based Exercise
Scenario: A student wants to create a quiz about Nigerian states. They want to ask questions and check if the answer is correct.
Question: What blocks would you use to create the quiz?
π₯ Group Activity
In groups of 4, each person creates one interactive element β a clickable sprite, a keyboard-controlled sprite, or a sound effect. Combine them into a project.
βοΈ Individual Activity
Create a project with a sprite that responds to clicks and keyboard presses. Add a sound and a score variable.
π οΈ Mini Project
Create a clicker game where you click a sprite to score. Add sound, a score variable, and make the sprite move randomly.
π Practical Assignment
Create an interactive story with at least two choices. Use "ask" and "if" blocks. Share with the class.
π Key Takeaways
- Events start your code.
- Sound adds excitement.
- Sensing detects interactions.
- Ask gets user input.
- Interactive projects are more engaging.
- Games use click, score, and sound.
π¬ Classroom Discussion Questions
- What is your favorite event block and why?
- How can sound improve a game?
- What kind of interactive project would you like to create?
- How can you use sensing to make a better game?
π Preparation for Module 4
In Module 4, we will explore Loops, Conditions, and Variables. You will learn how to repeat actions, make decisions, and keep track of scores.
Practice with events and sounds β we will build on these skills in the next module!
You have completed Module 3 β your projects are now interactive! π