Lesson 5: Events โ Starting Your Program
๐ฏ Lesson Objective
By the end of this lesson, students will be able to:
- Understand what Events are in Scratch.
- Understand how Events start a program.
- Use the Green Flag event.
- Start a program when a sprite is clicked.
- Start a program when a keyboard key is pressed.
- Use Events to create interactive projects.
- Combine Events with Motion and Looks blocks.
๐ 1. What is an Event?
An Event is something that happens and tells Scratch to start an action.
Think about everyday life:
๐ A bell rings โ You go to class.
๐ฑ Phone rings โ You answer it.
๐ช Door opens โ Someone enters.
In Scratch:
๐ข Green Flag clicked โ Start the program
๐ฑ Sprite clicked โ Make the sprite do something
โจ๏ธ Key pressed โ Start an action
Remember:
Event = Something that triggers an action
๐ก 2. Where Are Events Blocks?
Events blocks are found in the yellow Events category.
They are usually used at the beginning of a script.
For example:
๐ก When Green Flag Clicked
โ
๐ต Move 50 Steps
โ
๐ฃ Say "Hello!"
The yellow block tells Scratch when to start.
๐ข 3. When Green Flag Clicked
This is one of the most commonly used Events blocks.
when green flag clicked
When you click the Green Flag, Scratch starts the connected script.
Example
When Green Flag Clicked
โ
Move 50 Steps
โ
Say "Hello!"
Try It
- Add the Green Flag event.
- Add a Motion block.
- Add a Looks block.
- Click the Green Flag.
Watch your sprite perform the actions.
๐ฑ 4. When This Sprite Clicked
Scratch can also start a program when you click a sprite.
Use:
when this sprite clicked
Example
When This Sprite Clicked
โ
Say "You clicked me!"
Click the sprite.
๐ฌ The sprite will speak.
Try It
Change the message to:
“Hello! You clicked me!”
โจ๏ธ 5. When Key Pressed
We can use the keyboard to control our projects.
The Event block:
when [space] key pressed
starts the connected script when the selected key is pressed.
Example
When Space Key Pressed
โ
Move 50 Steps
Press the Spacebar.
๐ฑ The Cat moves!
๐ฎ 6. Create Keyboard Controls
Let’s make a simple keyboard-controlled character.
Step 1 โ Right Arrow
Use:
when right arrow key pressed
โ
move 10 steps
Step 2 โ Left Arrow
Use:
when left arrow key pressed
โ
move -10 steps
Now you can use the keyboard to move the sprite.
This is the beginning of Game Controls!
Later, we can use these ideas to create:
๐ฎ Maze Games
๐๏ธ Racing Games
๐ Space Games
๐ Adventure Games
๐ข 7. Broadcast Events
Scratch also allows sprites to communicate with each other using broadcast messages.
For example:
Broadcast "Start Game"
Another sprite can respond with:
When I Receive "Start Game"
โ
Say "Let's Play!"
This allows different parts of a project to work together.
We will explore Broadcast in more detail later.
๐ฌ 8. Events in an Animation
Let’s create a simple interactive animation.
Sprite 1
When Green Flag Clicked
โ
Say "Welcome!"
Sprite 2
When This Sprite Clicked
โ
Say "Hello!"
Now the two sprites respond to different Events.
๐งช 9. Practical Activity
Activity: Make Your Sprite Respond
Create three scripts.
Script 1 โ Green Flag
When Green Flag Clicked
โ
Say "Let's Start!"
Script 2 โ Sprite Click
When This Sprite Clicked
โ
Say "You clicked me!"
Script 3 โ Space Key
When Space Key Pressed
โ
Move 50 Steps
Test all three.
๐ฏ 10. Student Practice
Create an interactive character.
Your character should:
๐ข Green Flag
Say:
“Welcome to my project!”
๐ฑ Sprite Click
Say:
“You clicked me!”
โจ๏ธ Space Key
Move 50 steps.
โญ Right Arrow
Turn 15 degrees.
๐ฎ 11. Mini Game Challenge
Let’s create a very simple Click the Sprite Game.
Step 1
Choose any sprite.
Step 2
Add:
when this sprite clicked
Step 3
Add:
change size by 10
Step 4
Add:
say “You found me!” for 1 second
Your script:
When This Sprite Clicked
โ
Change Size by 10
โ
Say "You Found Me!"
๐ You have created a simple interactive game mechanic!
๐ง Quick Revision
| Event | What happens? |
|---|---|
| ๐ข Green Flag Clicked | Starts the project |
| ๐ฑ Sprite Clicked | Starts when sprite is clicked |
| โจ๏ธ Key Pressed | Starts when a keyboard key is pressed |
| ๐ข Broadcast | Sends a message to other scripts |
| ๐จ When I Receive | Responds to a broadcast |
โญ Challenge
Create a project where:
Green Flag โ Character says “Ready!”
Then:
Space Key โ Character jumps/moves
Then:
Sprite Click โ Character says “Great Job!”
Try to make your project respond differently to each Event.
๐ Practice Task
Project Name:
My Interactive Sprite
The project must contain:
โ
Green Flag Event
โ
Sprite Click Event
โ
Keyboard Event
โ
Motion block
โ
Looks block
โ
At least 3 different responses
๐ Learning Outcome
After completing this lesson, students understand that Events are triggers that tell Scratch when to start an action.
They can now make their Scratch projects respond to:
Green Flag + Mouse Click + Keyboard
This is an important step toward creating interactive stories and games.
ย