Please download pygamers.zip. This has the sample code that we will use. It has the following structure:
- basics - This folder contains basic python programs to introduce you to what python can do.
- draw - This folder contains a number of python programs that draw things.
- drawing.py - This module makes drawing easier. The other programs in this folder use this module.
- drawing.html - This contains pydoc generated documentation of the drawing module.
- game - This folder contains a few simple games.
- gaming.py - This module is a very simple framework for Pygame that makes games a little easier to write.
- gaming.html - This contains pydoc generated documentation of the gaming module.
Start with the basics folder. With the help of the tutorials, you should be able to understand what each file in this folder does. Look at the python files and run them and make sure that you understand the output. Feel free to edit these files. Playing with programs is what programming is all about. One of the files is a guess-the-number game. Copy it to another python file and try to change it to limit the number of guesses.
Next look at the programs in the draw folder. To understand these programs, you should look at the documentation in drawing.html. These programs draw a few different things including some national flags. Try to write programs to draw other shapes, maybe other flags. When you have mastered this, then look at drawing.py together with the Pygame documentation and make sure you understand how it works.
Now you are ready for the game folder. The games here use the gaming module, so look at gaming.html and gaming.py to understand how this module works. Then look through the games. When you understand the games in this module, you can try to write your own games.
Note that both the drawing module and the gaming module let you press the escape key to interrupt the program. Then you can use the python command line to inspect variables or do whatever you want. You can do run() from the command line to continue your program.