In Week Four we are looking at some more advanced concepts for controlling what happens in our video game projects:
Messaging: A type of communication within code or between different software components or even across systems. The sending code broadcasts a message; the receiving code is listening for that message and reacts based on the requirements. Publish/Subscribe represents a well-known Software Design Pattern that is implemented in different ways in different programming languages. In Scratch it is implemented by:
- a Broadcast Event; within the event declare a name for the message; example: Broadcast GameOver
- a Receive Event that is listening for the specific message and executes a script when that message is heard; example: when I receive GameOver show the end game background and play the victory tune.