SpaceGrab

A simple Java game made from scratch in 2014

JavaJava AWTJava Swing

Video Demo

What is it?

It is a Java game that I made from scratch in sophomore year of highschool. The goal is to evade the red dots (enemies) and aquire the yellow dots (tokens). You can collect the blue dot as a powerup to have the enemies fly away from you. You control your green dot with your mouse and the enemies will disappear once they collide with each other. Each time you get a token, your dot grows, but you shrink if you get hit by an enemy.

What was this built with?

SpaceGrab was built with Java and utilized both the Java AWT package and the Java Swing package for drawing the ui.

What were the biggest challenges?

This was the first playable game I made in Java so I was faced with many challenges. The biggest one was drawing the ui for the application which I used Java AWT to accomplish.

I recall spending weeks trying to figure out how pathfinding worked and eventually decided on just having the enemies go directly in a straight direction. My goal was to do a simple implementation and implement pathfinding in the future.

Back then I had no idea that you could create classes for enemies, powerups, and tokens. If I knew back then, this would've been far less complicated and the code would've looked much cleaner.

What did I learn?

Fortunately, I did learn an immense amount from this project.

I learned to not worry so much about accomplishing everything (pathfinding, obstacles, etc.), and just focus on accomplishing one challenge / feature at a time. I was new to creating games, especially from scratch in Java.

For example, the stars in the background are objects drawn using Java AWT. I wanted to have a moving background and have the stars move at different speeds depending on size. I originally was going to use a gif or a video, but looping it was too difficult. Eventually I decided to accomplish it with drawing multiple objects. This may not have been the most optimal way, but I was learning and that was what was my goal for this project: to take something scary and unfamiliar and accomplish it one way or another.

This project pushed me to try new unfamiliar things and the motivation got me to try web development in the first place. I learned to always try new scary things and no matter how long it takes to get to that point, it can get accomplished one way or another. This mentality is applied into my consulting work as I always get thrown with new challenges and need to provide solutions, whether that be figured out on my own or through help with some of my amazing and talented coworkers.

Check out the source code: