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.
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.
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.