Python Course: Games & Learning

Posted by Ben Weaver on Jan 6th, 2024
A Pygame with Robots

I recently wrapped up the coursework for the Advanced Course in Python Programming MOOC, offered by the Department of Computer Science at the University of Helsinki. I highly recommend this free online course for anyone interested in an introduction to Python. Prior to this, I also took the Introduction to Programming course, which laid a solid foundation. What stood out for me was the perfect balance between theoretical learning and hands-on practice. Unlike other programs I've tried, this one swiftly progressed through the basics, allowing me to reach my current level with ease.

The course structure included reading materials and practical exercises, and though optional, they also provided video lectures and a Discord channel for student interaction, resources I didn't personally use. With my final exam scheduled for the end of the month, I feel well-prepared to tackle it and confident in my ability to further hone specific or advanced Python skills independently.

For my final project, I dived into game development using pygame. The game involved collecting objects, dodging enemies, and keeping track of scores. Players navigate using arrow keys, collecting coins while leaping over monsters. To keep the game from being static, I added a progression feature: the more coins collected, the faster both monsters and coins moved. For the assignment, we were limited to specific image files: a monster, a robot, coins, and a door (which I didn't incorporate). The hardest part was figuring out how to get the robot to jump and come back down with one button press. With this trinket, you can see the code I wrote and try out the game:

Reflecting on the game, if I were to continue working on it, I'd enhance the visual appeal by creating a title graphic with Textcraft. I'd also add a start page featuring controls and a simple prompt like "Press Enter to Start," similar to the end screen I created.

After I was done, I initiated another project intended for my classroom website. However, I encountered limitations with pygame for creating a game accessible to my students on Chromebooks or on a school-approved website. Despite this challenge, I acquired a valuable skill: coding sprite animations using a tutorial from Coding with Russ.

I'd like to make more of this as my programming knowledge expands. More updates as I get further into this.