using UnityEngine;
using System.Collections;

public class arrow_logic : MonoBehaviour {

	private global_variables variable_script;
	private GameObject gameManager;

	private GameObject player;

	// Use this for initialization
	void Start () {

		gameManager = GameObject.FindGameObjectWithTag ("GameController").gameObject;
		variable_script = gameManager.GetComponent<global_variables> ();
		player = GameObject.FindGameObjectWithTag ("Player").gameObject;

		if (player.transform.position.x < transform.position.x) {
						transform.localScale = new Vector3 (1, 1, 1);
				} else {
						transform.localScale = new Vector3 (-1, 1, 1);
				}
			
		rigidbody2D.AddForce (variable_script.arrowProjection);

	}

	void OnCollisionEnter2D(Collision2D collision){

		
		Destroy (gameObject,0);
		
	}


	// Update is called once per frame
	void Update () {
	
	}
}
