Page 83 - Programming the Raspberry Pi Getting Started with Python
P. 83

A Raspberry Game
          To show how pygame can be used to make a simple game, we are going to gradually build up a game
          where we catch falling raspberries with a spoon. The raspberries fall at different speeds and must be
          caught on the eating end of the spoon before they hit the ground. Figure 8-2 shows the finished game
          in action. It’s crude but functional. Hopefully, you will take this game and improve upon it.






































          Figure 8-2    The raspberry game
          Following the Mouse
          Let’s  start  developing  the  game  by  creating  the  main  screen  with  a  spoon  on  it  that  tracks  the
          movements of the mouse left to right. Load the following program into IDLE:
   78   79   80   81   82   83   84   85   86   87   88