Page 56 - PlusGPT_V2.1_C1_Flipbook
P. 56

Some of the sensing blocks and their functions are given below:

                                             block prompts the user to type the input using the keyboard. It waits for the

                    user input. No other block runs at that time.

                                           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:

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





























                  Step 3:    Add a new backdrop to the stage, Arctic.

                  Step 4:    Now drag the ask block to the script area. Click on the block. A speech bubble appears
                           above the penguin with the text, “What’s your name?”.





                  54    Premium Edition-VI
   51   52   53   54   55   56   57   58   59   60   61