Retro time isn’t over yet!
Flickery Game Over text behavior? Hell yeah!!
Nostalgic yet? Old remember the times when games had this kind of Game Over behavior? And you just thought how cool it looked?
Well, why not add it in our game too! :)
It’s really simple and quick to do.
All you need for this is a
private Text _gameOverText;
private Text _restartText;
We have a method called GameOverSequence()
Which we call when our player dies
- In our GameOverSequence, we tell our Game Manager script that our game is over by calling the method GameOver()
The GameOver() method has only one job in the Game Manager script, it changes the scripts boolean _gameOver to true
- And we set active our _gameOverText and & _restartText
- Then we start a coroutine GameOverFlickerRoutin()
This is how the Coroutine works
- While it’s true, our _gameOverText.text is “GAME OVER”
- Then we wait 0.5 seconds
- And change the text to “ ” empty
- Then we again wait another 0.5 seconds
- And change the text field back to “GAME OVER”
Congrats! Now you can do this flickery game over text or menu text or whatever you want! :)
Thank you for stopping by and reading my nonsense again and again :D
Hope to see you at the next one! Ready… Set… GO!