The alarm block
Try itThings that talk to each other
Now for the sender. A block will send the message "alarm" when the hero steps on it.
A message in one script
To see a message work, here is a guard that sends one and listens for it too.
Try it
- Press Play
, under the little game. - Click the little game, so the arrow keys work.
- Hold the right arrow key to walk the hero toward the guard.
The guard sees the hero and sends "alarm". Its own last rule hears the message, so it shouts and jumps.
| Rule | What it does |
|---|---|
when I see the {Hero} | Sends the message. |
when "alarm" | Hears the message, and acts. |
Make the alarm block in your game
In your game, the sender is a block, not a guard.
- Press Open your game here, in the builder below, and go to level 2.
- Press the Behavior button
, on the left of the builder, and click the Script brush. - Click one block of your floor, a few blocks before the door. The Terrain script window opens.
- Press Code
. Type these two lines.
when the {Hero} steps on me
trigger "alarm"- Press Save
.
The block now has a little scroll on it while you build. That shows it has a script.
This section ticks itself when you press Play
in the code box.

