Retro Game Over message — Unity

Alberto Garcia
2 min readJan 16, 2023

--

The simplest message in arcade games was telling the player he failed and providing instructions to start again. Most old machines would deliver two statements, “game over” and “insert coin to restart”. This messages would be fixed text that would be turned on upon game ending with a flickering effect to call user’s attention. It is a great effect for that cause since it breaks immersion and would let people know when someone’s turn was over.

Let’s do that:

  • Flickering “Game Over” Text
  • Telling UIManager game is over
private TMP_Text _gameOverTxt;
[SerializeField]
private bool _isGameOver;

void Start()
{
_gameOverTxt.gameObject.SetActive(false);
_isGameOver= false;
}

public void GameOver()
{
_gameOverTxt.gameObject.SetActive(true);
_isGameOver= true;
StartCoroutine(GameOverFlicker());
}

IEnumerator GameOverFlicker()
{
while(true)
{
yield return new WaitForSeconds(1.25f);
_gameOverTxt.gameObject.SetActive(false);
yield return new WaitForSeconds(0.5f);
_gameOverTxt.gameObject.SetActive(true);
}
}

The public GameOver() method runs the message, sets the boolean to true and starts the coroutine(GameOverFlicker()) to display the message for 1.25 seconds and turn it off for half a second, repeatedly while the game is over and alive. This time cycle, I believe, let’s users read the entire phrase before flickering, which seems less annoying to me than faster flickering.

The simple retro-like message is working, the last thing is to inform the UIManager to call that method, and that’s the player’s last task before dying, telling the UI script that the game is over.

public void TakeDamage()
{
//rest of code... this next part calls the GameOver() inside UIManager script
else if (_ShieldEnabled == false)
{
_currentHealth --;
_uiManager.UpdateLives(_currentHealth);
if (_currentHealth < 1)
{
_spawnManager.OnPlayerDeath();
_uiManager.GameOver();
Destroy(this.gameObject);
}
}

Simplest way to inform the player is dead in the most old-school way.

Restart feature described on following post.

--

--