Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 117 - CodePilot V5.0 C4
P. 117

    LOGICAL OPERATORS  To add a Pen block, follow the given steps:

     These operators are used to combine two or more conditions. The operator checks
     if the conditions are true or false and gives the outcome.               Scratch offers 11 types of
                                                                              Extensions that can be added.
     This block checks if both conditions are true. It returns
     and
     true if both are true and false if one or both are not.                 2     Click on the Pen option.

     This block checks if either of the two conditions is true.
     or
     If at least one is true, it returns true, else it returns false.

     This block  is used  to  reverse the result of a given
     not
     condition.

     For example, let’s create the given script:

                       1     Click on the Add
                         Extension button.

     when  clicked
     if  100 >  50  and  100 >  60  then  Some of the commonly used Pen blocks with their descriptions are as follows:

     say  True, 100 is greater than 50 and 60
     else                                   erase all  This block clears all the pen marks from the screen.

     say  False, 50 and 60 is not greater than 100
                                                       This block creates a duplicate of the current sprite on
                                              stamp
                                                       the stage.
     21 st
     INTERDISCIPLINARY LEARNING  Century   #Critical Thinking  This block enables the sprite to draw a non-stop line
     Skills
                                           pen down
     Create a script to solve the given question: The robot has 228 gifts to pack and it can place 12   as it moves.
     gifts in each box. The robot needs to figure out how many full boxes are needed.

     Hint: Use the division operator.        pen up    This block turns the pen off and stops the sprite from
                                                       drawing anything on the screen.

                                                       This block sets the colour of the pen to a chosen colour
                                  set pen color to
                                                       from the drop-down menu.
     PEN BLOCKS                                        This  block  changes  the  pen’s  colour,  saturation,

                          change pen  color  by
     Pen blocks let your sprite draw on the stage. It is used to create shapes, lines and   brightness and transparency based on a given value.

     drawings in your project. These blocks are dark green in colour. The Pen blocks need
     to be added to the block palette before they can be used.   change pen size by  This block changes the pen size by a selected number.

                                                                                            Scratch Coding Adventures  115

| 112 113 114 115 116 117 118 119 120 121 122 |