How Scratch broadcasts work, and how to teach them
I am a Code Club volunteer, and before starting the third Code Club project (fireworks), I created a simple demonstration to show my club how broadcasts work in Scratch. I talked through it at the start of the session, and kept it as simple as possible, and the club members all had a go at making it before beginning the main project.
Teachers, Code Club volunteers, and Scratch students might also find it useful.
What are broadcasts in Scratch?
- You can't make one sprite move another sprite
- But you can make one sprite tell another one it's time to do something, and then that sprite can move itself
- To do that, you send a message using a broadcast
- Broadcasts are messages that one sprite sends to another
A simple demonstration of broadcasts
- Start a new project
- In Scratch 2.0, import the sprite Bat1
- If you're using Scratch 1.4, add sprite bat1-a, and add the costume bat1-b
- Add this script to the cat sprite:
- Add this script to the bat sprite:
- Run the program. When you click the cat, it sends an invisible message to the bat, the bat receives the message and flaps its wings and flies.
Try the example program
Click the cat to make the bat fly.
What else should I know about broadcasts?
- Broadcasts are sent to all sprites at the same time, but they don't all have to respond
- You can react to a broadcast from the same sprite that sent it
- So you need to take care that you put your 'reaction' scripts on the right sprite and don't do this by mistake
Demo card for sharing
Here's a card that encapsulates all this. Feel free to share the image below on Twitter, Facebook or your other social networks