First Android Game - Part 12 - Enemy Life PointAug 8, 2023This is part 12 of making my first Android Game. If you missed part11, you can find it hereI want to display enemy's lifepoint above the enemies so the users know how much damage they need to apply. My first attempt was to add a slider and text. However that looked very messy and took too much spaceSo I removed the slider and only used the textThe life point is displayed by setting TextMeshProUGUI text to the current life in Awake()As well as in OnTriggerEnterA lifepoint canvas prefab is created and attached to each enemy. The text size needs to be adjusted for each. The canvas is set to world space, and the canvas layer needs to be set so that the life point text is in front of the background but behind the scoreboardI wanted to add some sort of color change when the enemy gets hit such as what operation graduation does here. Or even animation. However, while I was searching up for ways to get a response. I noticed that in Evasion here, they make the lifepoints appear only if the enemy gets hit. This would help me resolve the mess I mentioned at the beginning!. So first thing in Awake is to disable the lifepoints gameobject - text and sliderThen update the lifepoints and call a coroutine if the lifepoint is greater then 0The coroutine will enable the lifepoints slider and text. After x amount of seconds it will disable the the lifepoints. Note that the coroutine is only called if the lifepoints is not enabledHere is the result. It is not as messy!See the next blog part 13 hereRecent blogsSee all blogs