using UnityEngine;
using System.Collections;

public class Camera : MonoBehaviour {
	private Vector2 velocity;

	public float smoothTijdY, smoothTijdX;

	private GameObject speler;

	// Use this for initialization
	void Start () {
		speler = GameObject.FindGameObjectWithTag ("Player");
	}
	
	// Update is called once per frame
	void FixedUpdate () {
		if (speler) {
			float posX = Mathf.SmoothDamp (transform.position.x, speler.transform.position.x, ref velocity.x, smoothTijdX);
			float posY = Mathf.SmoothDamp (transform.position.y, speler.transform.position.y, ref velocity.y, smoothTijdY);
	
			transform.position = new Vector3 (posX, posY, transform.position.z);
		}
	}
}
