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

  1. Add the Green Flag event.
  2. Add a Motion block.
  3. Add a Looks block.
  4. 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.

ย