Time for action - hide TOC

Before we begin, hide the dog by double-clicking the hide block from the Looks palette.

  1. Let's get back to the plain white background. With the stage selected, click on the Backgrounds tab. Select background 1.
  2. Display the Table of Contents, Dog-TOC, Horse-TOC, and Instructions sprites by right-clicking on each one from the sprites list and selecting show.
  3. Let's make the Dog-TOC sprite clickable. From the sprites list, select the Dog-TOC sprite.
  4. From the Control palette, drag the when Dog-TOC clicked block into the scripts area.
  5. Add a broadcast block to the script and create a new broadcast message: enter dog.
  6. When we click the Dog-TOC sprite, we want all visible sprites to hide. Select the Table of Contents sprite from the sprites list.
  7. From the Control palette, add the when I receive enter dog block to the scripts area.
  8. From the Looks palette, add the hide block to the script.
Time for action - hide TOC

What just happened?

Before we can play our scene, we need to clear the stage. We do that with the broadcast message that gets sent when we click on Dog from the table of contents.

From our previous projects, we learned that all sprites receive a broadcast message, but they do not act on the message unless told to do so. The exercise built those instructions, and if we were to click the Home button right now, only the words "Table of Contents" would disappear.

Your hero task is to make all of the other visible sprites hide.

Have a go hero

Finish the task. Hide the remaining table of contents items: Horse-TOC, Instructions, and Tables of Contents.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset