Galaxy Shooter 2D — Setting a Framework #19
A quick showcase of new mechanics and entities added to my game
Time to step up the game! If you’ve been following my Galaxy Shooter game articles, I’ve been writing about small concrete features and changes. This time, I want to experiment and talk briefly of every new feature I recently implemented.
Interfaces in code are like contracts: you declare a set of variables and methods without bodies (functionality), and the classes that inherit these interfaces must fully add the lacking functionality.
An interface for all entities that can receive damage is ideal, as I can access easily that interface without knowing the class that inherits it.
By pressing the Left Shift, the player ship will move faster. But doing so, it will drain fuel and it can only be refilled if the player stops using it for 2–3 seconds. Also, to use them, the ship must have a minimum amount of fuel (represented by the dark orange bar).
Enough mindless fun, the game needs challenges, and I want resource management to be one. I capped the ammo count to 30 lasers and added a UI bar to display it.
The previous UI was too simple, and it didn’t have a clear structure. I’ve changed that to keep all the information the player needs in at the top of the screen. I have more plans for the UI such as new graphics and new information to display, so I needed a good foundation to start.
Health and Ammo Pickups
With the new ammo limit, and the neverending waves of enemies, the player will need help to push through. I’ve added two new pickups, and in addition, all weapon powerups recover half the ammo count.
Shield Health and Invincibility State
The shield can now take up to 3 hits (1 if an asteroid hits the ship), and whenever the ship gets damaged, it will have a small invincibility window to get to safety.
Also, I implemented Camera Shake (stuff for another article).
Heat Seeking Lasers
Self-explanatory. These lasers will only target Enemy Ships (asteroids are ignored), and can wrap around the screen like the player ship. I will talk in-depth about this in my next article (remember to follow me on Medium ;) ).