Page 111 - 2422_C5_Flipbook
P. 111

Drag the Event block, when green flag clicked to the script area. Drag the control block, forever
                 to the script area and put it to the green flag block. Drag the move block and put it inside the
                 forever block. Now, drag the if on edge, bounce block and put it inside the forever block.
                 Now, put the control block if,then inside the forever block and snap the sensing block, touching
                 color in the hexagon of the if loop.
                 Now, create and run the given script.


























                 The butterfly changes colour and size when it touches the
                 colours selected in the touch block.                                       Tech Fact

                 Similarly, you can create scripts with two sprites, and they         A loop is a process that
                 change colour when they touch each other.                        instructs a computer to repeat
                                                                                   a set of commands a specified

                        CREATING A GAME                                                  number of times.


                 Let us create a fidget spinner that spins when touched with the mouse pointer. The first step
                 to create a fidget spinner is to draw a fidget spinner.
                 Now create the given script for the fidget spinner to spin.






















                 When you click on the green flag bring the mouse pointer on the fidget spinner sprite, it will start
                 spinning.


                                                                                       Conditional Blocks in Scratch  109
   106   107   108   109   110   111   112   113   114   115   116