using UnityEngine;
using System.Collections;

public class DestroyByFall : MonoBehaviour {

	public static PlayerController player;
	public bool follow;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (follow) transform.position = new Vector2(player.transform.position.x, transform.position.y);
	}
	
	void OnCollisionEnter2D(Collision2D other){
		if (other.gameObject.tag == "Player"){
			other.gameObject.GetComponent<PlayerController>().Kill();
		}
	}

	public static void SetFollowTarget(PlayerController nex){
		player = nex;
	}
}
