Page 49 - ModularV1.1 _c5_flipbook
P. 49

The Pen Block

                 Pen blocks in Scratch allow a Sprite to draw shapes and plot coloured pixels on
                 the screen. These blocks are colour-coded as dark green and are used to draw the
                 footprints of the Sprite.

                             BLOCKS                                          FUNCTIONS

                                                     This block puts Sprite’s pen up, so that it will not
                               pen  up
                                                     draw as it moves on the screen.
                                                     This block puts Sprite’s pen down, so that it will draw
                              pen  down
                                                     as it moves on the screen.
                                                     This block changes the pen colour based on your
                         set  pen  color  to
                                                     choice from the colour picker.

                                                     This block keeps the pen coloured  but lightens
                                                     or darkens the shade of that colour by the value
                      change  pen  shade  by 10
                                                     mentioned. For light shades, use negative values
                                                     and for dark shades, use positive values.

                                                     This block duplicates the Sprite’s image onto the
                                stamp
                                                     stage.

                     DRAWING A SQUARE


                 To draw a square, the script will be as follows:

                 Step 1  Drag the  when        clicked  block from the Events block menu.


                 Step 2  Drag the       clear  block from the Pen block menu. This will
                          clear any previously drawn image.

                 Step 3  Drag the       pen  down  block and        set  pen  color  to   block

                          from the Pen blocks menu.










                                                      Step 4  Now,  drag  the          move 10  steps   block and

                                                                 turn   15  degrees    block  from  Motion  blocks

                                                                menu. Change the values to 100 and 90
                                                                respectively. This becomes Move 100 steps

                                                                and Turn 90 degrees.



                                                                                       Drawing Shapes in Scratch  47
   44   45   46   47   48   49   50   51   52   53   54