🚀 In this tutorial, we’ll add collectible items that increase the player’s score, create health pickups that heal up to 5 hearts, and fix UI issues so extra hearts display correctly!
🔹 What You’ll Learn:
✅ Adding collectible items that increase the player’s score
✅ Displaying and updating the score in the UI
✅ Creating health pickups that restore missing health
✅ Capping health at a maximum of 5 hearts
✅ Fixing UI issues so extra hearts appear when healing
✅ Ensuring hearts update properly when taking damage or picking up health
By the end of this tutorial, you’ll have a fully functional and polished health & score system that’s clean, optimized, and visually correct! 🎮🔥
🎥 Next video: Enemies!
🔔 Subscribe for more Unity 2D tutorials!
🎵 Music by Eric Matyas
www.soundimage.org
#UnityTutorial #GameDev #Unity2D #Platformer #IndieGameDev #UnityEngine
-----------
Due to some issues with getting the UI to display the hearts, here's a brief, but better explanation than what I stumbled over in the video:
Player starts with 3 health, but max health is capped at 5.
Health pickups properly restore missing health but do NOT increase max health.
The UI now correctly updates to show extra hearts when healing up to 5.
Score items increase the player’s score, which is dynamically updated in the UI.
All systems now work smoothly together—health, UI, and score tracking!