Page 84 - Digicode_AI_class_5
P. 84

block checks if the sprite touches the mouse-pointer, another sprite
               or the edge. If the answer is true, then it executes the blocks given after it in the condition.

               If false, then it executes other blocks as per the given condition.
                               block checks if the sprite is touching the color chosen in the block. If true,

               then it executes a set of blocks, else executes another set of blocks.
                                     The  block  checks  if  the  first  chosen  colour  is  touching  the  second
               chosen  colour.  If  true,  then  it  executes  a  set  of  blocks, else  executes  another  set  of
               blocks.

                                   block checks if the chosen key is pressed by the user. If true, then it
               executes a set of blocks, else executes another set of blocks.
              Let us create a small script to understand the working of sensing blocks.

            Sensing an Input

            To add sensing blocks to the script, follow the given steps:










              1  Click on the
             Sensing  block
             category     in
                                                                                        2  Insert a sprite,
             Tabs.
                                                                                       Penguin2  on  the
                                                                                       stage. Delete the
                                                                                       cat sprite.



                          4  Now drag the ask block to the script area.









                                                                               5   Type  your  name.  Click
                                                                               on the tick button or press
                                                                               the Enter key.



                                                                               3  Add a new backdrop to
                                                                               the stage, Arctic.








                 82    DigiCode AI-V
   79   80   81   82   83   84   85   86   87   88   89