	using System.Collections;
	using System.Collections.Generic;
	using UnityEngine;
	using UnityEngine.SceneManagement;
	public class Move : MonoBehaviour {

	public float speed;
	public static bool veriColl1;
	public float speed1;
	public float speed2;
	public float speed3;
	public float speed4;


	public static bool pFinal1;

	public GameObject Worm1;


		void OnCollisionEnter2D(Collision2D coll){
			if (coll.gameObject.tag == "Obstaculo") {
				veriColl1 = false;
				//speed = 0;
				Debug.Log ("Dale");
			}
			if (coll.gameObject.tag == "Player") {
				speed = 0;
			Application.LoadLevel ("Game Over");
			//SceneManager.LoadScene ("GameOver", LoadSceneMode.Additive);
			}

			if (coll.gameObject.tag == "Chegada") {
				pFinal1 = true;	
			}
		}
			
		// Use this for initialization
		void Start () {
		veriColl1 = true;
		}

		// Update is called once per frame
		void Update () {
		
		if (Move2.veriColl2 == false) {
			speed = 0;
		}else{
			// Verificar se o jogo está ativo
			if (Input.GetKey (KeyCode.D)) {
				if (veriColl1 == false) {
					speed1 = 0;	
				}

				speed1 = 0.1f;
				transform.Translate (Vector2.right * speed1);
			}
			veriColl1 = true;
				if (Input.GetKey(KeyCode.A)){
					if (veriColl1 == false) {
					speed2 = 0;	

				}
				speed2 = 0.1f;
				transform.Translate(-Vector2.right * speed2);
				}
			veriColl1 = true;
				if (Input.GetKey(KeyCode.W))
			{if (veriColl1 == false) {
					speed3 = 0;	
				}
				speed3 = 0.1f;
				transform.Translate(Vector2.up * speed3);
				}
			veriColl1 = true;
				if (Input.GetKey(KeyCode.S))
				{
				if (veriColl1 == false) {
					speed4 = 0;	
				}
				speed4 = 0.1f;
				transform.Translate(-Vector2.up * speed4);
				}
			veriColl1 = true;

			//comando para ajustar o audio quando ele andar
			//gameObject.audio.Play ();
			}
	}
}

