Page 113 - CodePilot V5.0 C4
P. 113

Step  2    Add Baseball 1 backdrop.  Some of the commonly used Control blocks with their descriptions are as follows:

 Step  3    Create the given script for the sprite Batter and click the Green Flag to   wait  1  seconds  This block pauses the script for the given number of

 run the project.                                   seconds.


                                 repeat  10
 when  clicked                                      This block  repeats  the  action  inside  the  block  the
                                                    number of times you set.
 switch costume to  batter-a

 move  10  steps
                                 forever            This block repeats the action inside it forever, until
 switch costume to  batter-b
                                                    the Stop button is clicked.
 glide  5  secs to x:  20  y:  45

 next costume                    if       then
                                                    This block checks if a condition is true. If it is, it does
 if on edge, bounce                                 the action inside.

 say  Home Run for  2  seconds
                                 if        then

                                                    This block  checks  a condition  and carries out  one
                                 else
                                                    action if it’s true or a different action if it’s false.
 SOUND BLOCKS


 Sound blocks make your projects lively with music and voices. You can play sounds,

 change volume, add effects or record your own music by selecting the record option
 from the Meow down arrow.  SENSING BLOCKS

 Some of the commonly used Sound blocks with their descriptions are as follows:   Sensing blocks are used to get user input, check a sprite’s position or determine if

 It is used to play the selected sound and wait until it   one sprite is touching another.
 play sound  Meow  until done
 finishes before continuing the script.  Some of the commonly used Sensing blocks with their descriptions are as follows:

 It is used to play the selected sound without pausing   This block  checks  if the  sprite  is  touching  another
 start sound  Meow     touching  mouse-pointer  ?
 the script.                                        sprite, the mouse pointer or the edge of the screen.


 This block stops  all currently playing  sounds
 stop all sounds                                     This block checks if the sprite is touching a specific
 immediately.                touching color   ?     colour on the screen.



                                                     This displays a question on the screen and waits for
                    ask   What’s your name? and wait
 CONTROL BLOCKS                                     the user to type an answer.


 Control blocks help manage how your project runs by adding logic like loops, pauses   color  is touching  ?  This block checks if one specified color is touching

 and conditions. These blocks control the flow of a project.  another.




                                                                                        Scratch Coding Adventures  111
   108   109   110   111   112   113   114   115   116   117   118