Page 116 - CodePilot V5.0 C5
P. 116

when    clicked

                              set  score    to  0


                              forever
                                if    key  right arrow  pressed?  then


                                 change x by  10


                                if    key  left arrow  pressed?  then


                                 change y by -10



                                if    key  up arrow  pressed?  then

                                 change y by  10



                                if    key  down arrow  pressed?  then


                                 change y by -10



                                if   touching  Star  ?  then

                                 change score    by  1

                                 go to x: -120  y: 110



                                if    score  = 10   then


                                  say  You Win  for  2  seconds

                                 stop  all




                  Use the arrow keys on your keyboard to move the sprite up, down, left or right.

                  Whenever the sprite touches the Star, your score increases. If your score reaches
                  10, you win the game!


                                    Suppose you have to code a dance party in Scratch where characters keep
                                    dancing in a loop until stopped, which block will you use for this and which
                                    songs would you play in the program?






                  114     CodePilot (V5.0)-V
   111   112   113   114   115   116   117   118   119   120   121