Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 104 - logicode 2609 C5
P. 104

    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 scripts
                                       broadcast  message1
                                                                with matching "When I Receive ()" block.

                                                                This block sends a message and waits until other
                                broadcast  message1  and wait
                                                                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.

                      Step  4    Select the New message option from the drop-down

                                arrow  broadcast  message1    .

                                                   New message
                                                   message1
                      Step  5   Type the Wizard’s reaction in the  New message

                                name box and click on OK.

                      Step  6   Drag the     when  space    key pressed   block and put it

                                above the broadcast block.

                      Step  7   Drag the  say    Hello!  for  2  seconds  block and type the text after clicking the text

                                box.
                      Step  8    Create the given scripts for both sprites Wizard and Broom. Make the required
                                changes.

                      102   Premium Edition-V

| 99 100 101 102 103 104 105 106 107 108 109 |