Page 93 - TP_Play_V2.1_class5
P. 93

Step 4:  Click OK button.

                              The variable  appears  in the list  of  Variables
                            blocks. Observe that the  variable  name fruit
                            appears in all the blocks.
                                Now create the following script:


                                                                                           3

                                                                                                                4



                                                                                    Clickipedia


                                                                                    Every time you type a name
                                                                                    or  number,  the  previous
                                                                                    value in the variable gets

                                                                                    deleted and the new value
                                                                                    is stored.



                 The sprite will ask you to type your favourite fruit. When you press the Enter key,
                 the name of the fruit appears in the speech bubble of the penguin for the number

                 of seconds you have entered. The name of the fruit then appears as the value of
                 Fruit variable name on the stage.























                    CONDITIONAL BLOCKS

                 Many times, you have to do a task which is dependent on some conditions. For
                 example, you have to make mango shake. There are two conditions:

                 a.     Go to the refrigerator and check if there are mangoes. If mangoes are there,
                      then you will make mango shake.
                 b.   If the mangoes are not there, you will make cold coffee.



                                                                                 Creating a Game in Scratch       91
   88   89   90   91   92   93   94   95   96   97   98