World 5 · Messages · Guide 3 of 5Free guide
Can characters take turns?
Give each message a colour, and two characters can answer each other.
Meet the message colours
Messages can have different colours now: red, blue and green. Tap the dot on a message block to change it. A 📬 hat only hears messages of its own colour. So the rabbit can send red to mean 'fox, your turn', and the fox can send blue to mean 'rabbit, your turn'.
Same colour on the send and the hat: those two are talking.
See it work
Read all three programs first. The rabbit sends red. The fox listens for red and sends blue. The rabbit listens for blue.
🐇 When blue arrives
🦊
Step, red. Step, blue. Step, red. Neither moved twice in a row, because each one only answered the other's colour.
Your turn
Now you're the programmer.
Can the rabbit and the fox take turns?
Write the 🐇's answer, so they take turns all the way to the 🥕 and the 🍇.
The rabbit goes first
The fox's program
Blocks
Your program
Go further
What if the rabbit listens for red?
Change the dot on your 📬 hat to red. Now the rabbit hears its own message — every red it sends starts it again — and it runs off without waiting for the fox. A message colour is a name. Listen for the wrong name, and you answer yourself.
For grown-ups
Two programs that pass named messages back and forth are following a protocol — the same idea behind turn-based games and how computers on a network take turns talking.
Keep going
Next in World 5Message chains →Where this goes
Make a game other kids can play
The blocks on this page are a first taste. In a Kubrio project your kid builds a real game — powers, triggers, levels and all — and other kids get to play it.
