Page 194 - Scratch Programming Playground
P. 194

add the following code to the Fruit sprite.













































                             Script u hides the fruit at the start of the game. Script v
                         cleans up the Stage when the game ends by deleting clones
                         when the end game broadcast is received. Script w runs when
                         the player slices the Begin Button sprite and starts creating
                         clones.
                              let’s take a closer look at how script w works. after wait-
                         ing 1 second, the number of fruit variable is set to 1, 2, 3, or 4.
                         the code in the repeat number of fruit loop will create a new








      168   Chapter 7
   189   190   191   192   193   194   195   196   197   198   199