3D Platformer in Unity - Health System and Lives Counter

Опубликовано: 06 Октябрь 2024
на канале: Kozmobot Games
9,558
150

After a small break, I have finally decided to make another tutorial. This tutorial is about a lives counter in Unity, which is based on displaying the number of hearts on the screen. It uses a switch function that defines what to do when the variable health, which is a static int, becomes lower than one. It took me weeks to figure out how to make the lives counter work properly, because instead of losing one heart symbol, my game deleted two hearts from the game UI. You can see the change in the bottom right corner, which says that it took me 12 days to figure out.

DOWNLOAD the HEART asset: https://drive.google.com/file/d/1-hTK...

Simply import the heart asset by going to import settings and select Sprites 2D/UI.

To get the white circle image, make sure to watch the mobile input tutorial that describes the asset that you should add to your project.

The health system can be created in such a simple way. When adding a heart symbol, you can customize it whatever you want. The heart symbols in Unity can also be used as a symbol that can only act as a sprite. In this case, hearts are used as a game object. If no hearts are on the screen, the game over screen will be displayed.

This tutorial can also be considered a Game Over tutorial, because there is part of adding a game over screen and reloading the scene.

I was having a short break from making videos because of college obligations and judging with my second YouTube channel, which is for music production. You can now expect new videos every week.

Support the Creator of Kozmobot on the social networks!

CHECK OUT MY WEBSITE: http://kozmobot.com

INSTAGRAM:   / kozmobot.channel  

TIKTOK:   / kozmobot.channel  

Music:
Beckoning - Telecasted
Tic Tuc Theme Song - Kozmobot Music