Page 96 - 2502_Pakistan-kifayat_C-8
P. 96

Drag and drop your block
                               into the script area, to use   5
                               the block in your script.

                                                                     Below the  define block, add the   6
                                                                     blocks you want.



                                                                         Click on the Go button   7
                                                                         to execute the script.




















              Now, when you run your script, your sprite will spin and twist visually, then untwist, and return to its
              original appearance and direction. This creates a fun and eye-catching animation using custom code in
              a reusable block.


                   CLONING IN SCRATCH

              Cloning means making copies of a sprite while the program is running. Each copy is called a clone.
              Clones look and act like the original sprite but can do their own tasks independently.

              Using Cloning Blocks in a Program

              In Scratch, cloning is done using special blocks:

                               block runs the code for each clone when it is created.


                                 block makes a copy of the sprite.

                             block removes the clone from the stage when it is no longer needed.


              Creating Clones in Scratch

              To create clones of a sprite and position them randomly on the stage, use the following script:














                  94  Premium Edition-VIII
   91   92   93   94   95   96   97   98   99   100   101