Page 95 - TrackpadV1.0_C5_Flipbook
P. 95

when    clicked
                                                                       go to x: –50  y: 10
                        3  Type SpinningStopped in the New             set size to  90  %
                        message name box and click on OK.               forever

                                                                         if      key space   pressed?    then

                                                                           repeat   pick random 10  to  200

                                                                             turn   20  degrees


                                                                           broadcast  Spinning Stopped







                                                                           4  Add this block to the code of
                                                                           Wheel sprite after the repeat block.


                           CODE THE ARROW1 SPRITE


                 After broadcasting the message for the wheel, we need to add code               when       clicked
                 for the arrow sprite too. To add the code, follow the given steps:
                                                                                                go to x:   –140   y:  30
                 Step  1     Click on the Wheel Sprite and make it active.                      set size to   80  %
                 Step  2       Click on the Scripts tab and create the given code blocks.




                           CREATING A VARIABLE FOR THE GAME

                 To create a variable, follow the given steps:



                                                                                     3  Type Winner in the
                                                                                    New variable name box.







                         1  Click on Data
                         block.



                      2  Choose Make
                      a Variable.

                                                                               4  Click on OK button.






                                                                                          Creating Game in Scratch  93
   90   91   92   93   94   95   96   97   98   99   100