Sends a specified message to all objects and the background. Useful to communicate between objects and tell them when to do something.

broadcast.png

Why send broadcast messages?

With messages you can communicate and interact between different objects within a scene. It allows one object to send a message to all other objects, and the receiving objects can then react or respond to that message.

How does it work?

  • Sender object: The sender object starts the communication by using a "Broadcast" block. This block is used to send a message to all other objects in the scene (also the background).
  • Receiving object: The receiving object is the one that listens for and responds to messages. It uses the "When you receive" block to detect when a specific message is being received.
  • Message Handling: When the receiving object gets the message, it will execute all the blocks that are beneath the "When you receive" block. This allows you to define custom behavior or actions that occur when a particular message is received.

Correlates with this brick:

When Your Receive Brick
Learn more >>
 

Example

When you tap game over, the panda will disappear. You need two objects:

broadcast__-4.png

This is the script for the panda:

broadcast-__-5.png

And this the one for game over:

broadcast__-6.png

Note: select the same message in both bricks!

Result

null4.png

When tapped Example