Home · Academy · Robotics & Coding · Programming with Scratch · Broadcasting Messages and Managing the Stage

Broadcasting Messages and Managing the Stage

Coordinate sprites by broadcasting messages and manage backdrops and scene changes.

LESSON COMPASS

What will you use this page for?

Core idea

In Scratch, sprites can talk to each other without touching; one sprite "broadcasts" a message, others react "when I receive" it, and by switching the stage's backdrop we move between the different screens of a game.

Evidence to produce

Complete the page task with your own input, test conditions and reasoning.

Control trap

Message names that don't match The broadcast message and the received message must be exactly the same. start and Start may be different to Scratch; choosing from the drop-down prevents typos. Don't type it by hand — pick it from the menu. Nobody is listening You broadcast a message, but no sprite has a "when I…

Next connection

Clones: Create dozens of copies from a single sprite to manage many objects — such as raindrops, bullets or a swarm of enemies — with just one piece of code.

Module sources: Python Tutorial · Arduino Learn

LevelBeginner
Age10–16
Duration30–45 min
PrerequisiteVariables and Lists
ContentStandard lesson · 1,442 words
Last updated

One-sentence summary

In Scratch, sprites can talk to each other without touching; one sprite "broadcasts" a message, others react "when I receive" it, and by switching the stage's backdrop we move between the different screens of a game.

Why it matters

Think about a game: you click the green flag, a "Start" screen appears, and when you finish, a "You win" screen shows up. Who manages these transitions? Until now we wrote each sprite's job separately. But in a real game, sprites need to move together and at the same time.

This is exactly where broadcasting comes in. It lets one sprite say "I'm ready" and lets the others hear it and react. In programming this is called event-based communication: an event happens, and everyone who is listening responds.

Managing the stage goes hand in hand with this. A game's menu, its play screen and its ending are really just different backdrops. By switching the backdrop, you can build many "screens" inside a single project.

Short definition: A broadcast is an invisible signal that one sprite sends and every listening sprite can hear.

Talking through messages: "broadcast" and "when I receive"

In Scratch, the message blocks live in the Events category. There are two main blocks.

The "broadcast …" block

This block sends a signal. The signal has a name, such as start, you-win or enemy-hit. The moment the block runs, it announces this name to the whole project.

when green flag clicked
broadcast "start"

To create a new message name, choose "New message" from the drop-down on the block and give it a clear name.

The "when I receive …" block

This block is a listener. When the message you chose is broadcast, it runs the code below it. More than one sprite can listen for the same message; they all wake up at the same time.

Example: a cat sprite starts the game, and a star sprite hears it and becomes visible.

On the cat sprite:

when green flag clicked
broadcast "start"

On the star sprite:

when I receive "start"
show
go to x: 100 y: 50

As you can see, the two sprites never touched each other; they agreed through the same message. One called out, the other heard it.

The difference with "broadcast and wait"

The plain "broadcast" block sends the message and keeps going without waiting. The "broadcast … and wait" block waits until all the code listening for that message has finished. When you want a strict order (finish this first, then start that), "and wait" is the tool.

Managing the stage and backdrops

The Stage is the background of your game. Every background image you add to it is called a backdrop. The backdrop blocks are in the Looks category.

Switching the backdrop

The Stage has its own code area too. When the Stage receives a message, it can change its backdrop:

when I receive "you-win"
switch backdrop to "win-screen"

The event triggered by a backdrop change

The Looks category has another very handy Events block: when backdrop switches to [menu]. It runs automatically when a backdrop appears on the stage. So you can make enemies start moving when "game-screen" appears, or a cheering sound play when "win-screen" appears.

Example: celebrate when the ending screen arrives.

On the Stage:

when backdrop switches to "win-screen"
play sound "Cheer"

Example: building a three-screen game

Now let's combine what we learned into one flow. Say we have three backdrops: menu-screen, game-screen, win-screen.

1. Moving from menu to game

The Stage starts on the menu backdrop. A "Start" button sprite sits on the screen. When it is clicked, the game should begin.

On the Stage:

when green flag clicked
switch backdrop to "menu-screen"

On the Start button sprite:

when this sprite clicked
broadcast "start"

On the Stage:

when I receive "start"
switch backdrop to "game-screen"

2. Collecting points during play

On the game screen a player sprite collects stars. We have a variable named score (you remember it from the previous lesson). When the score reaches 10, we win.

On the player sprite:

when I receive "start"
forever
  if <touching "star"?> then
    change "score" by 1
  if <score = 10> then
    broadcast "you-win"
    stop [this script]

3. Moving to the win screen

When "you-win" is broadcast, the Stage switches to the ending backdrop and the player sprite hides.

On the Stage:

when I receive "you-win"
switch backdrop to "win-screen"

On the player sprite:

when I receive "you-win"
hide

These three pieces together form a full game loop: menu → play → win. What ties them all together is invisible messages.

Mini practice

Build your own two-screen mini game. The goal: move from a start screen (opened by the green flag) to a game screen when a button is clicked.

  1. Add two backdrops to the Stage: intro and game.
  2. On the green flag, set the Stage backdrop to intro.
  3. Add a sprite and write "Start" on it.
  4. When this sprite is clicked, broadcast the message start-game.
  5. When the Stage receives that message, switch the backdrop to game.
  6. Extra: when the game screen appears (when backdrop switches to "game"), have a character say "Ready?".

When it runs, click the button and watch the screen change. Then ask yourself: if I rename the message, do I need to update both the broadcasting block and the listening block?

Common mistakes

Message names that don't match

The broadcast message and the received message must be exactly the same. start and Start may be different to Scratch; choosing from the drop-down prevents typos. Don't type it by hand — pick it from the menu.

Nobody is listening

You broadcast a message, but no sprite has a "when I receive" block. Scratch gives no error; simply nothing happens. Remember to write the listener as well as the broadcaster.

Confusing backdrops with sprites

A backdrop belongs to the Stage; a costume belongs to a sprite. next backdrop changes the Stage's background, while next costume changes how a sprite looks.

Needing "broadcast and wait" instead of "broadcast"

If you move on without waiting for a task to finish, screens can overlap. When order matters, use "broadcast … and wait".

Safety note

This lesson is done entirely at the screen; there is no physical risk. Still, watch two things. Keep your screen time balanced: take a short break every 20–30 minutes and rest your eyes. Before sharing your project on Scratch, talk with an adult, and never share personal details (school name, address, phone) in the comments. Online safety, just like safety in code, starts with thinking ahead.

Lesson summary

Check questions

  1. Which category holds the "broadcast …" and "when I receive …" blocks, and what does each one do?
  2. How many sprites can listen for a single message?
  3. What is the difference between "broadcast" and "broadcast and wait"?
  4. What is the Stage's background called, and which block changes it?
  5. You broadcast a message but nothing happens. What are the first two things you should check?

Answers

  1. Both are in the Events category. "broadcast …" sends a signal; "when I receive …" runs the code below it when that signal arrives.
  2. There is no limit; as many sprites as you like can listen for the same message, and they all run at the same time.
  3. "broadcast" sends the message and moves on without waiting; "broadcast and wait" waits until all code listening for the message has finished.
  4. It is called a backdrop; it is changed with the switch backdrop to … or next backdrop block.
  5. First check that the broadcast name and the received name are exactly the same, then check that a "when I receive" block for that message actually exists.

Source and verification note

For “Broadcasting Messages and Managing the Stage”, verification focuses on whether the relationship between Talking through messages: "broadcast" and "when I receive" and The "when I receive …" block remains consistent across examples. Block names are kept consistent with the current core Scratch categories. Project behaviour should be tested separately for start-up, normal play, errors and restarting.

Next lesson

Clones: Create dozens of copies from a single sprite to manage many objects — such as raindrops, bullets or a swarm of enemies — with just one piece of code.

Start QuizBack to Programming with Scratch
QUESTION POOL

Reinforce this lesson with 10 questions

This lesson has a pool of 20 questions. Each attempt selects 10 and reshuffles the choices.