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

public class PopoScript : MonoBehaviour {

    Vector2 direction;

	// Use this for initialization
	void Start () {
        direction = (Random.insideUnitCircle + Random.insideUnitCircle)/2;
	}
	
	// Update is called once per frame
	void FixedUpdate () {
        GetComponent<Rigidbody2D>().AddForce(direction);
	}

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.layer == LayerMask.NameToLayer("enemy"))
        {
            //print("yes");
            Destroy(collision.gameObject);
        }
    }
}
