Time for action use sound to change the sprite's looks

Let's apply some graphic effects to our sprite based on how loud of a sound we make:

  1. We'll continue working with our sound script. Drag the script for the stage onto the sprite to duplicate the code.
  2. Select the cat sprite to display the scripts area.
  3. Swap out the next costume block with a change effect by block from the Looks palette.
  4. Select an effect from the list. I'm going to use the whirl effect.
  5. From the Sensing palette, drag the sensor value block into the input of the change effect by block.
  6. Select the sound option in the sensor value block.
    Time for action use sound to change the sprite's lookssound input, capturingnumeric sound value, using
  7. Now, make some noise to change the background and contort the sprite.
Time for action use sound to change the sprite's lookssound input, capturingnumeric sound value, using

What just happened?

Who knew you had such a powerful voice? When you speak, sprites listen. We used one sound input to control multiple actions, but each sprite independently evaluated the sound value to determine if it should execute the code in the script or not.

Have a go hero

Grab a friend and see who has the louder voice. We've worked with variables throughout the book. Write a script that records the sound sensor value to a variable, and then configure a sprite to report the value.

Take turns making noises, and see who can score the highest value. Get creative and make the sprite jump based on the sound value.

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

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