Back to Browse

Player Health System #1: Taking Damage (Unity Tutorial)

40.0K views
Apr 12, 2022
7:17

Beginner-friendly, Unity 2D tutorial showing how to set up a basic health system for your player. This video shows how to link your player's health to enemies, so they can deal damage. 📖 CHAPTERS 📖 0:00 - Demo and Project Setup 0:54 - Writing the Player Health Script 2:24 - Writing the Enemy Damage Script 6:04 - Setting up Enemy Damage in Unity 6:37 - Testing the Setup and Outro 💡 IF ENEMY IS MULT-HITTING THE PLAYER 💡 A common problem for some users is that the enemy multi-hits the player, sometimes even destroying him/her right away. Most often, this is because the enemy detects multiple collisions. As set up, the enemy will deal damage for EVERY collider on the player (including child objects of the player). If you want to make sure that only one collision occurs, edit your script to read: if(collision.collider.tag == "Player"). Adding the "collider" key word, will cause the damage to only be dealt once per attack, instead of once per collider encountered. 🛑 MUSIC 🛑 🔊Running Out - Patrick Patrikios Support by RFM - NCM: https://bit.ly/2xGHypM

Download

0 formats

No download links available.

Player Health System #1: Taking Damage (Unity Tutorial) | NatokHD