Michael_80 0 Newbie Poster

I am creating an animated sprite that collides w/ itself and destroys itself? How did they do this in 1992? I just want to hit an enemy and have the enemy disappear. Any help appreciated.
Using Unity 5.6 for game.

public class Hadouken : MonoBehaviour
{
    public Rigidbody2D bulletPrefab;
    public Transform spawnpoint;
    public AudioClip shootSound;

    private AudioSource source;
    private float volLowRange = .5f;
    private float volHighRange = 1.0f;
    private object coll;

    void Awake()
    {

        source = GetComponent<AudioSource>();
    }

    void Update()
    {

        if (Input.GetKeyDown("f"))
        {
            float vol = Random.Range(volLowRange, volHighRange);
            source.PlayOneShot(shootSound, vol);
            Rigidbody2D bulletInstance;
            bulletInstance = Instantiate(bulletPrefab, spawnpoint.position, spawnpoint.rotation) as Rigidbody2D;
            bulletInstance.AddForce(spawnpoint.right * 5000);
        }

    } void OnCollisionEnter2D(Collision2D coll)
    {
                if (coll.gameObject.tag == "Fireball")
                    Destroy(coll.gameObject);
                    Destroy(gameObject);
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.