Page 78 - Learn To Program With Scratch
P. 78

multiple sprites. The change volume by block reduces or increases the vol-
                         ume by the number you enter. Negative numbers make sounds softer, while
                         positive numbers make them louder. You can even show a sprite’s volume
                         on the Stage by checking the box next to the volume block. These blocks
                         are handy if you want to change the volume based on how close a sprite is
                         to a target (as in a treasure-hunt game) or make parts of a song louder than
                         others. You can also use these blocks to simulate an orchestra by playing
                         different instruments (with different loudness levels) simultaneously.



                                                   try it out 3-5
           VolumeDemo .sb2  The file VolumeDemo.sb2 simulates a cat walking into a forest . The application
                            uses the change volume by command to make the cat's sound fade away as
                            it goes deeper into the woods . Come up with some ideas to make this simulation
                            more real and try to implement them .


                         Setting the Tempo

                         The last three blocks in the Sound palette are related to the tempo, or
                         speed, at which drums and notes are played. Tempo is measured in beats
                         per minute (bpm). The higher the tempo, the faster the notes and drums
                         will play.
                             Scratch lets you choose a specific tempo with the set tempo to bpm
                         command. You can also tell a sprite to speed up or slow down the tempo by
                         a certain amount with the change tempo by command. If you want to see a
                         sprite’s tempo on the Stage, check the box next to the tempo block.




                                                   try it out 3-6
           TempoDemo .sb2   Open the file TempoDemo.sb2 and run it to see the set tempo to bpm and
                            change tempo by commands in action .



              Scratch Projects

                         The commands in the Looks and Sound palettes will help you add lots of
                         nifty effects to your applications. In this section, we’ll put everything we’ve
                         learned so far in this chapter together to create animated scenes of a per-
                         son dancing and some fireworks. This should help you review some of the
                         new command blocks and give you more practice with creating a complete
                         Scratch project.








           56   Chapter 3
                                           www.it-ebooks.info
   73   74   75   76   77   78   79   80   81   82   83