Page 91 - Trackpad_V1_Book 4_Flipbook
P. 91

uiz   Bee        Which block erases everything drawn by the pen?

                                          __________________________________________________





                            CONTROLLING A SPRITE


                 Scratch allows the user to control the sprite using various blocks. Let us learn more about
                 them.


                 REPEAT BLOCK
                 If you want to repeat a block of code a fixed number of times, the Repeat block is used.

                 With the Repeat block, you can draw Polygons. Examples of polygons are triangle, square,
                 pentagon, hexagon, heptagon, octagon, nonagon, decagon, etc.

                 Look at these polygons that can be made using the repeat block.



                            Polygon                                    Command



                  Triangle                          Repeat 3 Move 100 Steps Turn 120 degrees


                  Square                           Repeat 4 Move 100 Steps Turn 90 degrees

                  Pentagon                          Repeat 5 Move 100 Steps Turn 72 degrees


                  Hexagon                          Repeat 6 Move 100 Steps Turn 60 degrees

                  Heptagon                         Repeat 7 Move 100 Steps Turn 51 degrees


                  Octagon                           Repeat 8 Move 100 Steps Turn 45 degrees

                  Nonagon                          Repeat 9 Move 100 Steps Turn 40 degrees


                  Decagon                          Repeat 10 Move 100 Steps Turn 36 degrees

                 To draw polygons in Scratch, you must remember three points:

                 1.   You must know the number of sides in the shape. This is the value to be given in repeat
                     block.

                 2.  Each time a repeat command is used, you draw a line and turn at a corner.
                 3.   You must know the degree of the angle at the corner. It is very easy to calculate this.
                     Just divide 360 by the number of sides in the shape.




                                                                                         Drawing Shapes in Scratch  89
   86   87   88   89   90   91   92   93   94   95   96