Switch statement to optimize the various conditions

It’s fairly straight forward, we enable different powerups based on the ID of the power up. 0 is for the Triple Shot, 1 is for the Speed Up, and 2 is for the Shield. Now, I don’t like the default way this is done, so I’m going to convert it into an enumeration and case against that within the switch. Which means I’m going to go ahead and rename powerupID to PowerUpType and convert it from an int to an enum PowerUpType.

--

--

A few quality assets make a world of difference

In order to enhance our game, we’re leveraging a space-themed background sprite. We transformed it to fit the viewport of the camera, and setup additional sorting layers (background and foreground). We’ve foregrounded the player, which you can see has been replaced with a spaceship sprite, as well as the enemies that are spawned, which have been replaced with similar spaceship sprites. The laser beam has also had its sprite updated. The way to convert from prototype is to drop the 3D object and start leveraging a sprite renderer as well as a 2D box collider.

--

--

Laser shots instantiating and being destroyed after reaching a certain threshold (off-screen)

When dealing with game objects, especially those that are spawned during the runtime of your gameplay, you’ll want to take care to ensure their proper instantiation as well as cleanup, so that your object graph doesn’t become overly cluttered and eat up heaps of memory. In the case of Sovereignty, the player’s ship will be able to utilize various projectile weapons, starting with the basic single-shot rapid-fire laser. The spawn of the laser prefab is triggered by user input, specifically the spacebar:

--

--