Nerd For Tech
Published in

Nerd For Tech

Creating a Retro Game Over Behavior

Next up, let’s get a game over screen going for when our player dies.
First, we will create a UI text gameobject and enter GAME OVER as the text we wish it to display. We can increase the size to 50, but it won’t show up on our screen. To fix this, what we have to do is adjust the horizontal and vertical overflow:

Now we can go back into our UI script and set it up to turn on when we lose all our lives.

First, we want to create a serializefield for the text to be placed into. From there, we can set it to false at the start of the game so it isn’t on our screen. Next, we just let unity know that if currentlives == 0, then we want to turn it true so that we have it show up on our screen when we die.

Now that we have it showing up on our screen, let’s give it a more retro flashing look to it. There are a few different methods to achieving this, but for now we will just set it up as a coroutine.

Now, let’s see how it looks in our game.

And that’s it. We’ve successfully implemented a flashing game over script. Next, we will figure out how to load new scenes and create a main menu to work with.

--

--

--

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Recommended from Medium

My Guide for Submitting your PPP Loan Application at PNC Bank

Concurrency in Go: channels

Sailing Micro Integrator In Kubernetes

[Leetcode] Convert Sorted Array to Binary Search Tree

Spark 2.1 and Job Monitoring Available in DSX

Java Coding Standards

Tasker and Fitbit Integration

Delete

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
Jordan Evans

Jordan Evans

More from Medium

Optimizing the Animator and Callouts

Journal 148 — Unity Project Development, 2.5D Shooter

Scaling Bar HUD for Thrusters

Unity Basics by making a project