Creating a Retro Game Over Behavior

Objective: Create a game over screen with a retro feel

We need to create a new UI element.

Name it appropriately and Set the font size to 50. Set the Overflow options to overflow and reset your boarders.

adjust color to be seen on a light or dark background

Set the anchor to center and place the game over in the middle.

You don’t want this to be seen while you are playing the game so set the element to not active by unchecking the box at the top of the inspector.

Under the method you are using for your player’s death you can simply add this code to activate the UI game over element.

This will bring the game over element into view when the player dies.

To add a retro flicker to your game over element we can use a coroutine.

The “GAME OVER” will show for .5 or half of a second then the “” which means there is no text will show for half of a second. Once they code had reached the bottom it will start at the top of the coroutine and with while being true it will continue to cycle through the code.

All you must do now is start the coroutine when the game over is active.

Now your game over will slowly flicker like the arcade games of old. You can use this method to activate and deactivate UI elements however you desire. Experiment with this method and I’ll see you in the next tutorial.

--

--

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