Page 86 - Super Scratch Programming Adventure -1st Edition
P. 86

Program ❶ for the Car does a lot of work. First, it
            sets the costume, size, and position.
            The forever loop holds the rest of the program. The
            change y by -5 block will pull the car down, giving it
            gravity. The if touching color block makes the car
            bounce up whenever it touches the black part of the
            road, making it seem like they’re driving on a very
            bumpy road. The if key up arrow pressed? block
            will broadcast jump and then wait.




                         ❶






















                         ❷











                                             Program ❷ makes the car “listen” for the jump
                                             broadcast and makes the car jump up.
                                             The broadcast jump and wait block in program ❶
                                             will tempo rarily stop the first program so the second
                                             program can run.





                                                85
   81   82   83   84   85   86   87   88   89   90   91