Page 84 - Computer Genius Class 05
P. 84

block checks if the sprite touches the mouse-pointer, another sprite

                     or the edge.    the ans er is true  then it executes the  loc s gi en a ter it in the condition.

                         alse  then it executes other  loc s as per the gi en condition.
                                      loc  chec s i  the sprite is touching the color chosen in the  loc .    true

                     then it executes a set of blocks, else executes another set of blocks.


                                           The   loc   chec s  i   the  first  chosen  colour  is  touching  the  second
                     chosen  colour.      true   then  it  executes  a  set  o    loc s   else  executes  another  set  o
                     blocks.

                                          loc  chec s i  the chosen  ey is pressed  y the user.    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:
                  To add sensing blocks to the script, follow the given steps:










                    1  Click on the
                   Sensing  block
                   category     in
                                                                                              2   nsert a sprite
                   Ta s.
                                                                                             Penguin2 on the
                                                                                             stage. Delete the
                                                                                             cat sprite.



                                4  Now drag the ask block to the script area.









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



                                                                                     3  Add a new backdrop to
                                                                                     the stage, Arctic.








                       82    Computer Genius-V
   79   80   81   82   83   84   85   86   87   88   89