Page 89 - TechPluse_C4_Flipbook
P. 89

set pen color  to  50  block will set the pen colour, saturation,  brightness and
                   transparency to the given value.

                 Clickipedia




                   A loop is a process which instructs a computer to repeat a set of commands,
                   a specified number of times.


                     DRAWING POLYGONS


                 Polygons are 2D shapes with three or more straight lines and angles. Examples of
                 polygons are triangle, square, rectangle, quadrilateral, pentagon, octagon, etc.






                   Triangle     Square     Pentagon  Hexagon  Heptagon  Octagon              Nonagon      Decagon
                  (3 sides)    (4 sides)   (5 sides)    (6 sides)    (7 sides)   (8 sides)    (9 sides)   (10 sides)

                 To draw polygons in Scratch, you must remember a few thumb rules. These are as
                 follows:

                    You must know the number of sides of the shape. This is the value to be given
                   in Repeat block. For example, you give Repeat 3 to draw a triangle and 4 to draw
                   a square.

                    Each time a Repeat block is used, you draw a line and turn at a corner.

                    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 of the shape. For example, to draw a
                   triangle, the turn will be 360/3 (sides of the triangle) = 120.

                 Look at these polygons that can be made using 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






                                                                                       Programming in Scratch        87
   84   85   86   87   88   89   90   91   92   93   94