Over the past 3 months, I’ve been taking Harvard College’s online Intro to Computer Science course, CS50x. It’s being offered through edX, a relatively new non-profit addition in the world of MOOCs (Massive Open Online Courses), an initiative that’s been gaining traction in the last year or so in education. In fact, edX (founded by MIT and Harvard University) proclaims itself as “the future of online education.”
The courses through edX are free, and they are essentially mirror images of their respective University undergraduate courses, loaded with lecture videos, resources, and in many ways most importantly – an active online community. Tons of resources, a helpful online community, and free of charge? Sign me up.
I’m going to fast forward to my last 3 weeks of the course, whereupon I spent my time coding a zombie-themed computer game as my final project submission for the class.
Before I get to the details I present to you, “Sanitation: Z” (excuse the choppy video quality, I promise it’s not actually this laggy):
The object-oriented game was programmed using Python and Pygame. Here’s the gist:
- You roam around finding a way out of the maze while avoiding contact with zombies.
- You collect supplies like extra ammo and a flashlight which will aid you along the way.
- All zombies spawn with randomized health, speed, and sight range to add some dynamism into each game.
- The maze itself is formed by reading from an external text file and constructing the level based on information on where obstacles should be placed.
My biggest challenge was detecting collision between two different coordinate planes: the viewable screen and the world. As you will notice from watching the video clip, the rectangular camera stays centered on the player and is a fixed size, but the area of the actual world is much larger. Essentially both had their own “surfaces”, and so figuring out the formula for translating the coordinate (x,y) position of the screen relative to that of the game world was the trickiest part.
Oftentimes while programming, there’s a level of intimacy with the project that other people just won’t share. The challenges and bugs that took me days to figure out how to fix won’t be immediately obvious to anyone else when looking at the end product. There’s a tremendous sense of satisfaction for me though, knowing all that I had to troubleshoot and debug my way through in order to get to the finish line.
So there it is. There’s definitely room for improvement and expansion, (new weapon types, environmental power ups, mini maps, boss encounters…) but I’m quite proud of what I was able to accomplish in the final weeks of the course. (See my overall thoughts on the CS50x class here)
P.S. And just for fun, here’s the Scratch game I made at the very start of the course for comparison: