Time for action - the horse talks

Let's write some barnyard humor:

  1. From the Looks palette, drag the say Hello for 2 secs block into the script area.
  2. Change the message from Hello! to How do you.
  3. Add another say Hello for 2 secs block.
  4. Change the message from Hello! to make it rain?.

    Tip

    If the sprite is close to the edge of the stage, the speech bubble that displays from the say block may appear at the backend of the sprite.

  5. Add a third say Hello for 2 secs block.
  6. Change the message from Hello! to Mow a hay field.
  7. Change the time from 2 seconds to 1.
  8. Add a wait 1 secs block.
  9. Change the time from 1 to 3 seconds.
  10. Add the say Hello block to the script.
  11. Change the message from Hello! to Is this thing on?.
  12. Double-click the script to watch our horse tell its first joke.
Time for action - the horse talks

What just happened?

We wrote a short script to deliver the joke using the say block to display speech bubbles. After three seconds of silence, our horse tossed out a comedic cliché, "Is this thing on?"

We introduced two variations of the say block. For the joke and punchline, the horse spoke for a specified number of seconds. However, at the end of the script, the say block we added did not specify a time value. And if you look at the stage, you'll notice that the speech bubble still displays Is this thing on?.

Synchronize the action

If we want the action in our script to continue while the speech bubble displays, we use the say block without a time value. For example, we could make a sprite speak while moving across the stage.

If we use the say block with a time input, the speech bubble displays for the time specified. However, the next block in the script does not execute until the time elapses. This gives us a way to synchronize our scripts.

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

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