using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerBullets : MonoBehaviour {

    private Rigidbody2D rb;
    public float bulletSpeed;

    void Start() {
        rb = GetComponent<Rigidbody2D>();
    }

    void Update() {
        rb.velocity = transform.right * bulletSpeed;
    }

    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Enemy") {
            Destroy(gameObject);
        }

        if (collision.tag == "PlayerBulletDestroyer") {
            Destroy(gameObject); 
        }
    }
}
