Page 81 - Digicode_AI_class_4
P. 81

Events Blocks

            Events blocks control how the blocks in a script will start to run if a particular action is
            done. Events blocks manage events and script execution. They are yellow in colour.

                        Blocks                                          Functions

                                            This block activates the script when the green flag or Go button
                    when     clicked
                                            is clicked.



               when space    key pressed    This block activates the script when the chosen key is pressed.




                 when this sprite clicked   This block activates the script when you click the sprite.


                                            This block sends a message to all sprites, triggering them to
              broadcast      and wait       do something, and waits until they all finish before continuing
                                            with the next block.


                                            This block pauses the running of the script for the specified
                   wait  1 seconds
                                            number of seconds.



            Control Blocks

            Control blocks have looping blocks which are used when the same blocks have to be repeated
            a number of times.


                   Blocks                                           Functions

               wait  1 seconds     This block pauses the running of the script for the specified number of
                                   seconds.

                repeat   10

                                   This block repeats a set of blocks a given number of times.




               repeat until        If the condition is false, it runs blocks inside and checks the condition
                                   again. If the condition is true, it goes on to the blocks that follow.



                forever            This block keeps on repeating a set of blocks until the stop button is
                                   clicked.  It  is  similar  to  a  repeat  block  and  expands  automatically  to
                                   accommodate the blocks you snap inside it.




                                                                                      Blocks in Scratch   79
   76   77   78   79   80   81   82   83   84   85   86