Portfolio Project 14: GUI Game

Day 95 of the 100 Days of Code course’s goal was to recreate the Space Invaders game. To accomplish this task, I decided to work with Turtle Graphics and build on the knowledge gained from completing the Breakout Game Clone project from earlier in the course.

Gameplay - Game in progress

Having completed the Breakout Game Clone in a previous project, that game provided a baseline for me at how I tackled this project.

The goal for the day was to create a clone of the Space Invaders game. To complete this project, I first educated myself on how Space Invaders worked to provide myself with some guidelines on how to tackle this project.

After familiarizing myself with the game, I then tackled this project by completing the following general steps.

  • Create the screen
  • Create the players cannon
  • Create the bunkers
  • Create the aliens
  • Create laser objects for both the player and aliens
  • Keep track of score, high score, lives, and bunker hit points
  • Configure game flow logic

This project greatly benefited from using object-oriented programming. Using OOP, I was able to break this project down into the tasks listed above. With OOP, figuring out the positioning of objects was made very easy such as where the rows/columns of aliens should be placed as well as bunker placement. Without OOP, testing and rendering those objects would have taken up an insane number of lines.

Testing - Aligning objects

Once everything was created and rendered, testing needed to be completed to make sure that the current score, high score, lives, bunker health alien movement, and levels were being tracked properly. With a bit of tweaking, the game performed as desired!


That is not to say this project was completed without any trial and error.

The biggest challenges I encountered were pertaining to the mechanics of the laser object. and moving objects off screen.

Beginning with moving objects off screen, it had been a minute (many minutes…) since I worked on the breakout game. I was initially updating the screen in both main.py as well as in the files related to the objects. This was creating phandom objects on the main screen that would not disappear when they were hit. After going back to my notes and looking at my previous work, I had then caught this mistake and corrected it. After removing the screen updates from the classes, objects were able to properly move off screen.

Another headache was figuring out how to make sure that the laser objects would work for the game. In the game, I ended up creating three types of laser objects.

  • Player laser
  • White alien laser
  • Red alien laser

The challenge here was that each object had to have different mechanisms for how the laser would fire. For the player, this part was easy, the firing mechanism would be controlled by a key press. The challenging part was figuring out a mechanic that would work for the aliens. For the red alien, I ended up using conditions that would check if the red alien was in play. If the red alien was in play, then the laser would be fired randomly. For the white aliens (the most challenging ones to configure) I was going to initially follow a similar mechanic to that of the red alien however, I didn’t want to have 50+ randomized timers going off in the background for all the alien objects. I settled on creating a laser object for each row of aliens that would fire off randomly. If there was an alien in a row, then the row would send out a randomized fired shot from an alien’s position.


This was my 17th project completed for the course, so a lot of things flowed smoothly from drawing out what needs to be accomplished, breaking tasks down and troubleshooting bugs that have come up. This was a fun project to complete and having previously completed the Breakout Game Clone project, helped in planning and setting up this project. Looking at how I completed the Breakout Game project, I made refinements onto how I coded this project and implemented lessons learned from that project into this one.

All in all, this was a fun project to complete and work with the quirks of using Turtle Graphics.

Gameplay - Gameover