Retro game over

Kasper Møberg Rasmussen
2 min readApr 12, 2021

As part of the GamedevHQ 2D game course I was tasked with creating a retro game over screen. So, a great big text box saying “GAME OVER”, but to add some spice, make it flicker on and off.

First I need the great big GAME OVER text, a simple UI text element handles this nicely.

Note the horizontal and vertical overflow settings, allowing me to not worry about the width and height of the field being able to contain the text. Also note that it starts with the game object being disabled, so the text is not immediately displayed to the player.

When the player takes damage it forwards the amount of health remaining to the UIManager which updates the lives display, and if the player health is less than or equal to zero, it starts the FlickerGameOverRoutine coroutine which sets the _gameOverText, to active, waits a second, sets it to inactive, waits 0.5s and then starts over, because its trapped in an infinite while loop.
Infinite loops are usually a bad thing, but because this is broken up by yield statements, its perfectly safe.

--

--

Kasper Møberg Rasmussen

Masters graduate of Learning and experience technology from University of southern Denmark, with a passion for the future of interaction.