Page 113 - CodePilot V5.0 C5
P. 113

Step    5    Click the   play sound  grunt  until done   block drop-down arrow to add sound.

                              If  the desired sound is not available, you  can add  it  from the  Sound
                              library under the Sound tab.


                 Step    6    Click the   glide  1  secs to x:  0  y:  0   block text box to set the gliding position

                              of the sprite.

                 Step    7    Now,  click the  Monkey sprite  and create              when    clicked
                              the given script.                                       wait  0.5  seconds

                 Step    8    Make the necessary changes in the blocks                say  Oh! Its a lion.  for  1  seconds

                              as per the script to bring your project to life.       glide  1  secs to x: -202 y:  56

                 Step    9    Click the Green Flag to run the project.               play sound Chee Chee  until done





                        BROADCAST AND RECEIVE BLOCKS


                 The Broadcast and Receive blocks are found in the Events block category. These
                 blocks  allow sprites  to  communicate  with  each  other  without  being  directly

                 connected. This is useful for controlling different parts of a story or game. Here are
                 the Broadcast and Receive blocks and their uses:

                                                           It starts the script when the specified broadcast
                              when I receive  message1
                                                           message is received.

                                                           It sends a message  to  all  sprites,  triggering
                                  broadcast  message1
                                                           scripts with matching "When I Receive ()" block.


                                                           This block  sends  a message  and  waits  until
                           broadcast  message1  and wait
                                                           other scripts finish before moving on.


                 Let’s create a small script using above blocks. To do
                 so, follow the given steps:

                 Step    1    Create a story using the Wizard Girl and

                              Broom sprites.
                 Step    2    Choose a suitable backdrop.


                 Step    3    Drag  the     broadcast  message1   block  from

                              the Events block category.




                                                                                                Scratch Meets AI   111
   108   109   110   111   112   113   114   115   116   117   118