Time for action - give me another "M"

When we last left our script, the Second M in Mom displayed on the screen. Now let's display the First M in Mom.

The second letter M broadcast the message next m, so that is where we begin this exercise:

  1. Add the Control block when I receive next m to the scripts area for the First M sprite.
  2. Add the show block.
  3. Let's rotate the M this time. From the Motion palette, add the turn clockwise 15 degrees block to the show block.
  4. Click the flag to set the script in motion. Note that the first m is tilted 15 degrees. Click the Stop button when you've seen enough.
  5. Wrap the turn clockwise 15 degrees block in a repeat 10 block.
  6. Change the input value on the repeat block to 25.
  7. Add a broadcast block and create a new message gimme an O. Click the flag to run the script and watch the M spin in place. Click Stop when you've seen enough.
Time for action - give me another "M"

Run the script multiple times. Note how the letter M has a different orientation each time the script runs.

What just happened?

Excited to get the call from the Second M sprite, First M tumbled onto the stage. The repeat block instructed the M to turn clockwise 15 degrees for a total of 25 times. Each time we click on the flag, the script starts from the M's position on the screen, which means the M will end at a different spot each time.

If we run our script enough times, our M inverts and looks like a W. That just won't do.

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

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