A collection of my older python games made during middle school. Some of them use Pygame, others were made for an iOS App called Pythonista. Many reference random assets from my old desktop, have bugs, or both. The code itself is of poor quality and often written in python 2.7, which is what the book I learned from used. The full source code of all semi-completed projects is available on GitHub. Some of the more impressive ones are highlighted here.
Earth Defender
Earth Defender is one of the most complete games, made during middle school, with a core gameplay loop of destroying asteroids to defend the earth. The mechanics are simple, with the only nuance being the ship selection where you can choose between an occasional ability to destroy all asteroids and continuous faster shooting. The game implements a simple highscore system indexed by username, with scores being saved to a text file.
Pacman
Pacman is another relatively complete game, containing simple randomized ghost movements, player animation, score, and screen wrapping around edges for both the player and the ghosts. Grid-based movement is present, with the programming remembering requested turn directions until the next grid point. This was one of my first games to use an internal clock to regulate game pace instead of a while loop, resulting in consistent gameplay across devices.
Minecraft Clone
I had recently purchased Minecraft, and was interested in it, so I decided to try and make something like it myself. This was my first experience with 3d graphics, and my only one in Pygame. Much of the difficulty of this project was the 3d geometry involved, especially as Pygame itself does not provide any 3d graphics functionality. The cubes are drawn by face, in depth order (no culling is done) and it is not performance optimized at all, but it accomplishes its goal of being a simple 3d project, and more importantly, it contained challenging math and was a great exercise in more advanced vectors and trigonometry.
Jumping Dinosaur
Inspired by the Google Chrome dinosaur game, I decided to make my own version of it. After copying many of the sprites, I made a simple procedurally generated jumping game. There is also a highscore system, 3 lives, and a pause menu.
Flappy Bird
Flappy Bird was my first more intricate game, containing procedural column generation. The main challenge I came across when programing this was implementing pixel perfect collision with the columns, something that involved a lot of math and intersection calculation, as well as finding the closest point on a line to another another point.
Evolution
This evolution simulation is based on colors, with agents reproducing when touching each other. The children are dispersed randomly in the arena to continue their own lives. Offspring color is based on the rough average of the parents’ colors, with the occasional mutation resulting in a more drastic variation. Agents can die from old age or from having too many children.
Snake
As with many beginners, my first game was snake. It’s simple enough, yet teaches many valuable lessons about program flow, game logic, and simple graphics. My implementation included the basics of food, movement, and growth, as well was wrapping around to the other edge of the field when leaving the bounds of the screen.