Space Invaders!

Space Invaders!

Hello there,

I've had a blast working through this course! I just wanted to share a demo of my project, a clone of the original Space Invaders. Here's a video the gameplay. I’ve also uploaded the Jack VM files for the game so you can play it too. If you do try the game, I recommend that you set the VMEmulator clock speed to "medium".

Taking on this project was a bit more ambitious than I originally anticipated. I had to tackle a number of fun challenges, including creating a custom sprite engine for precise control over sprite location, and implementing the “centipede” motion that aliens make as they approach. I also had to "reverse" the character bitmaps from the `Output` OS class.

Creating the sprite engine was quite rewarding. The engine needed to be able to draw sprites at any x, y coordinate, provide efficient collision detection, and produce reversed output (white sprites over a black background). The original provided sprite framework only allowed me to move sprites by increments of 16 pixels in the horizontal direction. This limitation made the game less challenging, because it was easy to shoot aliens when you could line up with them easily. The new sprite engine works by splitting the sprite between two adjacent memory locations as needed. In addition, I wanted the game refresh loop to be efficient, so the sprite engine was updated to detect collisions more efficiently.

I implemented the centipede motion of the aliens that’s present on the original game, by implementing an object that only moved one alien per game refresh. This also had the effect of making the refresh loop quite fast, since moving (up to) 55 aliens in one refresh loop caused a lot of lag in the game.