Message Passing
One of the hardest things my students had to come to grips with was message passing.
In this case there are three sprites: a title which must be shown at the start but not thereafter, a graphic that has to be shown when required and a button that needs to remain at all times. (The program is written to allow for many sprites).
When the green flag is pressed, the title is shown and the graphic sprite is hidden because a message is sent to hide everything that recieves the "hide all" message.

When the cat button is clicked, the title is hidden as well as anything else. Then the cat sprite is displayed.

The cat sprite listens to messages and if it recieves a hide message it disappears and if it receives a show message, it shows itself.

To see a working program that uses broadcasting to hide and show sprites, download the following Scratch file.
http://cscos.pbwiki.com/f/hideshow2.sb
http://cscos.pbwiki.com/f/hey%20diddle%20diddle%20v2.0.sb
Comments (0)
You don't have permission to comment on this page.