Teaching Python and Pygame

I have recently been offered the opportunity to teach Python and Pygame to a class of secondary schoolers. This will be part of an after-school “Spring enrichment program”, where students get to choose an activity for 7 weeks over the spring term.

While planning lessons, I have been finding it challenging to cram enough useful information into 7 x 1-hour long sessions while still having time to answer questions, fix bugs and of course actually make some games. I want the kids to walk away from every session with something that they can actually see happening- something any game developers will know is not easy, given the number of concepts that must be taught, and boilerplate code it takes before you can even draw simple shapes to the screen.

I will spend the first session teaching absolute basic programming fundamentals: variables, importing, if statements/comparisons, and then touch on functions and loops while making a simple number guessing game that gives “higher” or “lower” hints until the player guesses correctly. This will just be using Python, and not Pygame.

In the next few sessions, we will learn the basics of arrays while making a tic-tac-toe game, before jumping into Pygame and learning about classes. We will be making a flappy bird clone, which offers an excellent way to introduce more interesting ways of using variables, and also learning how to draw things to the screen. If we have time after that, I would also like to build a snake clone.

The challenge of boilerplate code still remains, however. I have decided to provide the group with a pre-written Pygame initialization/game-loop, which they will then build classes on top of. I will make sure to comment this code very descriptively, so that any students who are interested can have a look to learn more about how their objects actually get turned into a running game.

I will also be creating a section on my website to upload information to acompany these sessions, so that any of the students who are interested can access information from home (as previously stated, these sessions do not run for very long.) These pages will offer help in installing python and pygame at home, the basics of using python and pygame, advice on dealing with common errors, and other related tips, such as where to get assets/how to make them. I will try to keep these pages separate from the rest of my blog, as they generally fall outside of the scope of technical art, but I will likely still add to them after the course is finished.

I would actually recommend that other developers try teaching (or at least prepare to teach an imaginary class). It is an excelent way to develop your skills, as it forces you to take the things you have learned and have been taking for granted, and look at them from a different perspective.  It also makes you think about the concepts you often use, and boil them down to their simplest parts, while trying to come up with the best way to explain them.

Here is a video of the games I will be teaching:

Leave a Reply

Your email address will not be published. Required fields are marked *