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.

IDamageable Interface

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.

Thrusters

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).

A small fragment of the Thrusters code

Ammo Limit

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.

New UI

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.

Has a nice Retro style to it, and it is all event-driven!

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 ;) ).

--

--

--

Junior Unity Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Network jargon for dummies

Flux XDAO: Get ready to rule the Kingdom!

Take part of our Bug Bounty Program 👨‍💻💰

Text in SwiftUI

How to Send E-Mails In Ubuntu Server Via NodeJS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pablo Gómez Platón

Pablo Gómez Platón

Junior Unity Developer

More from Medium

How to fetch data from API in Unity

Installing Unity and Getting Started with Game Development

Lining up Audio & Visual to Build Cutscenes in Unity

Creating a Moving Platform in Unity