Game Programming: Coding for Fun 261
After mastering the concepts in this chapter, you should be
able to do the following:
• Recognize common game design elements in games and apps
that you use.
• Incorporate game design elements into apps that you code.
• Build a skeleton of a game by drawing the board and playing
pieces and adding user interaction.
• Program collision detection between game pieces and keep
score in an app or game.
• Display text information on the screen using the pygame.font
module.
• Write game logic to determine when a game is over.
• Detect and handle keypress events in Pygame.
• Develop the code to start a new game or play again after a
game ends.
• Use math and logic to make games progressively more difficult
• Add sounds to your apps with the pygame.mixer module.
• Display percentages and rounded numbers to keep users
informed of their progress in a game.
• Understand the process of iterative versioning: adding features
to an app one at a time and saving it as a new version (1.0, 2.0,
and so on).
Programming Challenges
For sample answers to these challenges, and to download
the sound files for this chapter, go to http://www.nostarch
.com/teachkids/.
#1: Sound Effects
One feature we could add to Smiley Pong, version 2.0, is
sound effects. In the classic Pong console and arcade game,
the ball made a “blip” noise when players scored a point and
a “buzz” or “blap” noise when they missed. For one of your
continued