Page 103 - 2422_C4_Flipbook
P. 103

Step 5:  Click on Pen blocks category        .

                 Step 6:  Click and drag the       pen down  block to the script area and snap it to the script.

                 Step 7:   Click on the block      set pen color to    and drag it to the script area. Snap it to the

                         script. Click on the colour dot and choose a color of your choice.

                 Step 8:  Click on     erase all  block and drag it to the script area and snap it to the script.

                 Step 9:  Next click on Control blocks category        .

                 Step 10: Click and drag the   repeat   10   C block to the script area. Snap it to the script.



                 Step 11:  Now we will have to click on Motion blocks category        .

                 Step 12:  Next drag the  move  10 steps  and  turn    15  degrees  blocks and snap them inside the
                         C block. When you position any block inside the C block, it expands to fit the blocks.
                         Change the steps from 10 to 100 mention to change the degree from 15 to 90.

                 Step 13:  In the repeat block, click and change the number of repeats from 10 to 4. Why are we
                         doing this? We know that a square has 4 sides.


                 Step 14:  If you do not want the sprite to appear over the figure, you can end the code here. But
                         if you want to see both the shape and the sprite, snap the  show  block at the end of

                         the code.
                                                                                            Tech Fact

                                                                                    In Scratch, each number is
                                                                                    equal to 1 step of the sprite
                                                                                    on the stage. So, these 100
                                                                                    steps form one side of the
                                                                                    square.  In the  turn block,
                                                                                    change the degree from 15
                                                                                    to 90. Why are we changing

                                                                                    the  degree?  Remember,
                                                                                    360/4 = 90 degrees.

                      Drawing a Rectangle in Scratch

                 To draw a rectangle in Scratch, follow the same code you used to draw a square. In the repeat
                 block, change the values of the Repeat and Motion blocks as shown in the given code.

                 You can also draw a multi-coloured rectangle. To do so, remove the           set pen color to    block

                 and place the block       Change pen color  by 10  in the Repeat block. Change the value from 10
                 to 25. Click on the Go button.





                                                                                         Creating Shapes in Scratch  101
   98   99   100   101   102   103   104   105   106   107   108