Page 50 - ModularV1.1 _c5_flipbook
P. 50

Step 5  Now, drag the  wait       1 secs   block from the Control block menu. This will let

                           the program wait for 1 second before going to the next statement.

                  Step 6  Repeat Steps 4 and 5 three more times.

                  Drawing a Square Using Repeat

                  In the previous example, a square was drawn using Pen, Move and Turn blocks. In
                  order to avoid repetition of commands, REPEAT command is used. This command

                  reduces the number of lines of commands you need to write to draw a figure. The
                  Repeat block in the Control blocks menu is used to do this task. You can drag
                  the blocks and keep inside the Repeat block. Let’s draw a square using the Repeat
                  block.

                                        repeat  4
                  Step 1  Drag the                  block from the Control blocks menu.




                  Step 2  Drag the  move 10       steps   block,  turn   15  degrees   block and  wait  1 secs   block

                           one by one and attach inside the Repeat block. Change the values.
                  The script will be like this now:










                                               4









                      DRAWING A POLYGON

                  A regular polygon is a closed figure with all sides of equal length and all angles

                  of equal size. In a regular polygon, the number of sides is equal to the number of
                  angles. Some regular polygons are shown below.










                    Equilateral Triangle            Square                  Pentagon                 Hexagon
                          (3 sides)                (4 sides)                (5 sides)                (6 sides)


                  48      Modular (Ver. 1.1)-V
   45   46   47   48   49   50   51   52   53   54   55