Broadcast and Receive

Broadcasting messages is crucially important as you begin to build sophisticated Scratch applications and is covered formally as part of the lesson plan to ensure that every Scratch programmer understands the principle of messaging even if they do not use it in their applications.

The children should already understand that events such as pressing the green flag to start the project or pressing a key can be used to control the application and perform a sequence of commands. Broadcast is a way to get a sprite (or the background) to send a message to all the other sprites in the application which can then react to the message by performing a series of actions. Moving to a different level in a game, for example, requires that the background changes and the sprites show and hide themselves and move around the screen. This is extremely difficult to coordinate without using broadcast and receive.

The concept could be explained to the children as one object shouting out a message such as ‘I have crashed into another sprite’ and the other sprites (and the background) listening and reacting to the message. It is also a great way to get several sprites to perform an action at the same time and might be used to synchronise a dance routine so that all sprites move to the beat together for example. This is the example used in the tutorial video.

21/12/2024 12:24:36