using UnityEngine;
using System.Collections;

public class EnemyHealth : MonoBehaviour {


/*SCRIPT FOR WHEN THE PLAYER IS HIT, NOT THE ENEMY*/
    public static float health;

    
    void Start() {

        health = Random.Range(50, 500);
    }
    
    // Update is called once per frame
    void Update() {

        if (health <= 0) {
            Destroy(gameObject);
        }

    }

    //allow the player to only be hurt by the enemy 
    void OnTriggerEnter2D(Collider2D other) {
        if (other.gameObject.tag == "Enemy") {
            Debug.Log("hit");
            health = health - 1;
        }
    }

}