Wake everyone up
Try itThings that talk to each other
One message can have many listeners. An alarm that only opens a door is a waste of a good alarm.
A guard that hears the alarm
This guard sleeps until it hears "alarm". In this code box, a timer sends the message after 3 seconds, because there is no block to step on.
Try it
Press Play
and count to 3. The message goes out, and the guard wakes.
The guard's last rule does not care who sent the message. A block, a timer, another enemy: it is all the same to the listener.
Wake the enemies in your game
- Press Open your game here, in the builder below, and go to level 2.
- Place an enemy or two on the far side of the door.
- Press Select
, click an enemy, and press Character scripting
. - Press Code
. Take out the script that is there, and type this one.
when I start
stand still
when "alarm"
say "Who is there?"
chase the {Hero}- Press Save
.
Now step on your alarm block. The door opens, and behind it every enemy wakes up and comes for the hero.
This section ticks itself when you press Play
in the code box.

