using System;
public class Program
{
public static void Main()
void OnCollisionEnter(Collision collision)
if (collision.gameObject.name == "Spike") // this defines what object to collide with to trigger the if statement
damage = 1;
health = health - damage;
Debug.Log("HP = " +health);
}
if (health == 0)
Destroy(gameObject);
Debug.Log("Wasted");