Page 99 - ConceptGP_C5_Fb
P. 99

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 Code tab and create the given code blocks.




                           CREATING A VARIABLE FOR THE GAME

                 To create a variable, follow the given steps:



                      2  Choose Make
                     a Variable from                                             3  Type Winner in the
                     the Variables                                               New variable name box.
                     section.












                      1  Click on
                     Variables block.


                                                                                            4  Click on OK button.


                                                                                          Creating Game in Scratch  97
   94   95   96   97   98   99   100   101   102   103   104