Creating a HUD (part 3)
Creating a Game Over Screen
Every game needs a game Over screen especially when the player has lost all its lives or has enter a instant death trap such as spikes. This game over screen would also give the player the ability to start over again or return back to the Main Menu.
Prepping the Game Over screen:
I made the layout within Adobe Illustrator and made sure that there will be two buttons that will control the level restart and another button that take the player back into the main menu. Save the final layout as a PNG file and import the file into Unity.
Slice the image into the desired size and create a new UI Panel within the Canvas. Then we are going create new image objects within the Panel and organize the images from top to down.
Finally we are going to create a new animation within the Panel itself so we can animate all 3 components within the panel.
Within the Animator we are going to create a parameter which will trigger the popup whenever the parameter is called. We are also going to create an empty state that will become the default state.
Triggering the Game Over Screen:
Within the player script in the the Damage method, we are going to trigger the Animation parameter whenever the health is less than 1.
Now whenever the player health is below one, the pop up will trigger and prompting the animation.