This game draws from inspiration such as Space Invaders, Galaxian, as well as more modern works such as Touhou. The biggest inspiration, however, probably comes from Phoenix for TI-83 and TI-84, written in Assembly. Texas Instruments calculators got me interested in programming and eventually became my first experience in writing code, through the horrendous TI-BASIC.

What it does

The player progresses through 4 increasingly complex levels. The first level is by far the simplest, intended to introduce anyone unfamiliar with the genre to how it functions. The rules are simple: destroy various invading enemy ships while avoiding death by a plethora of multicolored projectiles. The first level requires a combination of pattern recognition and nimble reaction time to pass. The second level adds an element of mindgames to the traditional shooter. Two of the enemies faced, Illusions, are untouchable with laser fire, while another two, Spectres, are invisible. In order to pass the level, the player must be able to deduce the locations of the two invisible enemy ships without falling prey to the distraction of two visible but untouchable enemy ships. The third level is built around forcing the player's strengths against the player.It is the only level where you can completely predict enemy actions. because they are responses to the player ship. For example, one enemy mirrors the player's position while firing back, while another reflects all incoming fire. In order to pass the level, the player must think one step ahead, answering the question "How do I trade fire such that I always come out ahead?" The final level features a boss with large amounts hp and firepower. This level also introduces homing missiles that actively the follow the player. However, their turning rate is limited, so it is possible to avoid them by waiting until they get as close as possible, then dodging at the last second, which forces the missile to loop back around. The missiles detonate in balls of fire, which deal large amounts of damage over time. Similarly, the boss's purifier laser is very weak if the player is able to get out of the way very quickly, but is capable of doing very large amounts of damage over time. In order to beat the level, the player necessarily has to make sacrifices, avoiding one source of damage by getting hit by another, and requires quick decision making as well as planning ahead.

How I built it

The entirety of the game is written in Java 8, taking heavy advantage of Java's java.awt library. No external libraries were used. All the code was composed and edited using NetBeans IDE. All the sprites used were created through GIMP, using images found online as starting points.

Challenges I ran into

Rotating images was a problem for me. I ended up using the transformation matrix which rotates the image clockwise by a factor of theta. For the homing missiles, I used arctangent to find the angle between the missile and the player. However, java's implementation of arctangent goes from 0 to pi halves, then negative pi halves to pi halves, then negative pi/halves back to 0, going counterclockwise. Also, angles are necessarily modular arithmetic as well, making this more complicated. I was able to solve the issue with a few if clauses that translated the range to a smooth curve from 0 to 2*pi.

Accomplishments that I'm proud of

I created the game with a lot of room to scale in mind. I tried to hardcode as little as possible, and I made it as simple as possible to create new levels, new classes, and new game mechanics. This required a large number of abstract classes and polymorphism. Essentially, every object had some variant of an act() method, which would govern the specific behaviors of that class. All the objects existed within an arrayList, which would be iterated over to call act() on each object. This means that expansion is very easy. For example, each level is simply a list of the enemies involved. Any new enemies can extend public abstract class EnemyShip, which holds the basic capabilities of any enemy ship, and requires only unique behaviors be implemented.

Also, my soundtrack is sick, using completely free and unlicensed music.

What I learned

This was my first hackathon, as well as my first programming project of this kind of scale. Needless to say, I learned a lot. I think the most valuable thing was learning when something is "finished". Because of limited time, it's impossible to work on something forever. Consequently, I had to know when to drop or scale down certain features because of time constraints, and accept products as "finished" even when I wasn't satisfied with them.

What's next for Invasion--Game

This game really needs to have a way to restart the game. As it is now, the game simply stops execution at the game over screen until you close and reopen the executable. This would also include checkpoints and save files, allowing you to save and load at the beginning of each level. I would also add the ability to change the player's ship, either temporarily in the form of powerups, or permanently in the form of unlockable alternate ships chosen at the beginning of the game.

Built With

Share this project: