So as my question asked I already have my self a Script to take damage when my AI hits me or collides with me. I don’t want it to go to -10 -20 but when I hit 0 I respawn at a set location
using UnityEngine;
using System.Collections;
public class DamagePlayer : MonoBehaviour
{
public int playerHealth = 100;
int damage =10;
void Start()
{
print(playerHealth);
}
void OnCollisionEnter(Collision _collision)
{
if (_collision.gameObject.tag == "TheOneThatKillsTheLeast")
playerHealth -=damage;
print("I have taken damage" + playerHealth);
}
}
will I have to link to a new code or is it possible to take damage and kill within this script.
thanks all for the help.