2D Galaxy Shooter: UI and VFX!

Gabriel Perez
4 min readApr 17, 2021

Hello everyone! A lot has happened since my last progress update! I added a 3rd power-up, created a simple UI, and added some VFX to spice up the visuals.

Before getting into them, I want to say that the journey so far into becoming a Unity Developer has been an experience! It is more than what I had hoped for it to be! It’s like an actual class in College but straight to the point with no fillers.

Onto some progress!

I can now collect a shield power-up! The implementation went smoothly. Different than the others.

Since the shield power-up gives a permanent effect, I had to make sure that when the player collected the power-up, then to make sure that the player wouldn’t get damaged if the shield is active. Below you can see the shield in action. You can also see other features I’ve added, such as the UI elements and VFX.

You can also see other features I’ve added, such as the UI elements and VFX.

Using Unity’s UI Toolkit is really neat and simple. It offers so much flexibility to come up with a complicated UI if needed. It was also really cool to know how to implement the lives UI. This opened up a lot of knowledge with the use of arrays!

I also had the pleasure of creating the Main Menu and load into the Game scene. Check it out below!

I had to learn how to add the “SceneManagement” library so that I can use the SceneManager in a script to load a new scene.

public void RestartScene()
{
SceneManager.LoadScene(1); //Game scene
}

I added a Game Over a sequence of events when the player dies through the use of coroutines.

And to pad my ego a bit, I went ahead on my own to create a timer when a new game starts before spawning enemies and power-ups.

The timer is in reverse! I fixed it in a recent update.

I used the fundamentals of script communication, a bool to control the logic, and a coroutine! Stuff I learned the past two weeks.

Here’s the logic for the start timer:

private IEnumerator StartSceneTimerRoutine()
{
_sceneStartText.text = “”;
yield return new WaitForSeconds(1f);
_sceneStartText.text = “3”;
yield return new WaitForSeconds(1f);
_sceneStartText.text = “2”;
yield return new WaitForSeconds(1f);
_sceneStartText.text = “1”;
yield return new WaitForSeconds(1f);
_sceneStartText.fontSize = 120;
_sceneStartText.text = “GO!”;
yield return new WaitForSeconds(1f);
_sceneStartText.gameObject.SetActive(false);

_gameManager.IsNewScene = false;
}

I have also implemented a visualizer of different stages of the player’s lives. When the player has three lives, there is no damage. When the player has two lives, an engine is destroyed. When the player has one life, show another engine destroyed.

I would have thought that such a system would be difficult to implement! It’s fairly easy. All we need to do is check to see if lives equal two and one. If they do, then each one would have the game object with the damage animations activated.

if (_lives == 2)
_enginePrefabs[0].SetActive(true);
else if (_lives == 1)
_enginePrefabs[1].SetActive(true);

The enemies can now explode when shot. When destroyed, I trigger an animation of them exploding. The “enemy destroy” animation has a slight pause before the explosion sequence starts. So I took the liberty to delete the first eight frames of the animation, and it now looks smooth like butter.

Deleting the first eight frames from the Enemy Explosion animation.

The next section is about adding the icing on top of the visuals, Post Processing!

I want to add that I did quite a lot to cover this progress update. I would like to post progress through each section of the courses so that they can be smaller, cleaner, and organized.

Until then, thank you for reading!

--

--

Gabriel Perez

Hello everyone, My name is Gabriel Perez, I am a Unity Developer and a creator who is always learning and experimenting.