In the same spirit as having the enemies “go boom”, it’s would be great to also show the player has taken damage.


Enemies that just disappear in an instant aren’t really that satisfying.

Unity has made it easy for us developers to load scenes, which is pretty important. Sure you could do everything in one single scene, but that might be more trouble than it’s worth.

Creating a retro game over screen in Unity is pretty straightforward. All that’s really needed is a few text elements.

The UI Manager script has serialized fields, that I’ve dragged the text elements into. For my game over screen, I wanted the main text to be static, with a flashing “instruction” underneath it. All other parts of the UI are hidden, except the score.

When the player dies the UI Manager is told that the game is over, and starts a coroutine that takes care of the rest 😀

Handling the player pressing the R key is handled by a different script since that technically has nothing to do with the UI.

Unity makes it easy for us to create a User-Interface (UI) for our game.

Right-clicking in the hierarchy and going into the UI section of the menu that pops up, gives you a list of various elements to use.
As you can see, most of them are pretty self-explanatory 😀
Evident by there being two different types for some elements, there’s also something called TextMeshPro.
TextMeshPro, often abbreviated to TMP, provides more advanced features. I’ll be sticking with the ‘default’ one here, though.

For my game, all I really need is some text and image displays. …

Swapping out if-else if-else with a Switch statement.

If you have an if-else statement with several different conditions to check for, it can get quite unruly, fast.
By using switch statements instead, you end up with something where it is easier to see what is happening.

Since I plan on having more than just 1 power-up, I will make it something a bit more modular.

Making it modular, means I don’t have to create a new script for each and every variant I need. Instead, I can use one script that holds enough information for it to indicate what powerup it is.

Doing it this way, I only have to change a variable and replace the sprite!

I opt to use IDs to represent the different kinds of powerups.

Determining how long power-up effects should last.

Not all power-ups are created equal, some might provide a bigger upside than others and might benefit from being limited in some way.
For my triple-shot I want it to be a limited duration power-up.

Sometimes having just a static image for your player, or any other object for that matter is not the best experience.
Movement is often crucial for making things come to life.

Having created the powerup, to be able to grant the player the ability to use the recent addition of the “triple-shot laser”, this is starting to feel more like a real video game!

Kenneth Skodje

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