This lesson introduces the Pygame set of modules, in addition to a couple new programming concepts (constants and tuples). The Pygame code is fairly involved, but the actual game built will be quite simple. Pygame could theoretically be used to create any number of different games, but this lesson only covers the basics.
Students should play through an example of a game built in Pygame in the warm-up activity. The student who completes the most levels can be awarded points. Although the game is much more advanced than what is covered in this lesson, students will see the possibilities of the framework.
Present the Pygame PowerPoint Presentation. Review the presentation ahead of time, including the notes in the slides. There are several animations.
The activity walks through the construction of a rudimentary top-down, tile-based game. Even with such a small game, there is some complexity in the code. Make sure students understand the importance of each step taken.
The challenges task students with building on the top-down game. They also have the option of doing something completely different in Pygame; that should be encouraged.
For the challenge portion, one option would be to pair students up randomly, and have them work together to solve the challenges via pair programming. Replit's Multiplayer feature would make this fairly simple from a logistical perspective, but it may or may not be desired from an educational perspective.
Activity | Time |
---|---|
Warm-up Activity | 10m |
PowerPoint | 15m |
Break | 5m |
Code-Along | 60m |
Challenges | 30m |