Page 124 - 2627_Trackapd_pro_Class_3
P. 124

CREATING VARIABLES IN SCRATCH

                  To create variables in Scratch, follow the given steps:

                  Step  1     Click on the Variables block

                              category.

                  Step  2     Click  on  Make a Variable
                              button.  Type  a variable
                              name  in the  New variable

                              name box.

                  Step  3     Click on the radio button of
                              one of the options. Click on

                              For this  sprite only  if you
                              want the variable to appear
                              only for the selected sprite.


                  Step  4     Click on OK button. The variable appears in the list of Variables blocks.
                  Now, let us create a small script of counting scores.


                  Step  1     Add  Water and  Rocks backdrop  from
                              the  Backdrop library and  Frog sprite
                              from the Sprite library.




                  Step  2     Now, create the following script:


























                  You will notice that whenever you press the spacebar, the frog moves 10 steps

                  forward, and the count in the variable name (Score) on the stage updates.




                  122   Premium Edition-III
   119   120   121   122   123   124   125   126   127   128   129