So I have been trying to make my object(a sphere with sphere collider and sphere collider trigger) follow my player,but the script is giving out errors and i have no idea what do they mean,and how to fix them,here is the piece of code I wrote:
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (playerdestructor == true)
Debug.Log ("touchy");
rigid.AddForce (Vector2.MoveTowards (self, player, 10f));
if (playerdestructor == false)
Debug.Log ("lonely :(");
}
void OnTriggerEnter2D (Collider2D col){
if (col.tag == "Player")
playerdestructor = true;
}
void OnTriggerExit2D (Collider2D coly){
if (coly.tag == "Player")
playerdestructor = false;
}
}