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

public class CreditMovementScript : MonoBehaviour {

	float moveSpeed = 150f;
	bool reachedDestination = false;
	Vector3 destination;

	// Use this for initialization
	void Start () {
		destination = new Vector3(this.gameObject.transform.localPosition.x, -1 * this.gameObject.transform.localPosition.y, this.gameObject.transform.localPosition.z);
		Debug.Log (destination.y);
	}
	
	// Update is called once per frame
	void FixedUpdate () {
		this.transform.localPosition = Vector2.MoveTowards (this.transform.localPosition, destination, moveSpeed * Time.fixedDeltaTime);
		if (this.transform.localPosition == destination)
		{
			reachedDestination = true;
			LoadMainMenu ();
		}
	}

	public void LoadMainMenu()
	{
		SceneManager.LoadScene ("TitleScreen");
	}

}
