#pragma strict
var boxCollider : BoxCollider;
var velocity :int = 5;
var inv:int = 1;
var timer: float = 5;
var player:int=0;

var idol=false;

var players : String[,] = new String[4,4];
//Player1
players[0,0] = "w";
players[0,1] = "a";
players[0,2] = "s";
players[0,3] = "d";
//Player2
players[1,0] = "y";
players[1,1] = "g";
players[1,2] = "h";
players[1,3] = "j";
//Player3
players[2,0] = "p";
players[2,1] = "l";
players[2,2] = ";";
players[2,3] = "'";
//Player4
players[3,0] = "up";
players[3,1] = "left";
players[3,2] = "down";
players[3,3] = "right";





function Start () {
boxCollider = GetComponent(BoxCollider) as BoxCollider;


}
Screen.SetResolution(1280,720, true, 0);

//function debuff(int choice)
//	{
//		//switch statement for each debuff
//		switch (choice)
//		{
//			case 1:
//				//invert controls
//				invert = -1;
//				timer -= Time.deltaTime;
//				break;
//			default: invert = 1;
			
	

//	}


function getIdol()
{
	idol = true;
	
}
	


function Update () {

	var cp = GameObject.Find("Louis").GetComponent(MovementBasic).cp;
	if(GameObject.Find("Louis").GetComponent(MovementBasic).keyboardEnabled)
	{
			
				if(Input.GetKey(players[cp,2]))
		{
			//sprite.sprite = Resources.Load("Sprites/Main", typeof(Sprite));
			rigidbody.velocity = (Vector3.forward * -1 * inv* velocity);
			boxCollider.size = Vector3(0.8,1.6,0.3);
			
		}
		else if(Input.GetKey(players[cp,0]))
		{
			rigidbody.velocity = (Vector3.forward * inv* velocity);
			boxCollider.size = Vector3(0.8,1.6,0.3);
		}
		else if(Input.GetKey(players[cp,1]))
		{
			rigidbody.velocity = (Vector3.right * -1 *inv* velocity);
			boxCollider.size = Vector3(0.5,1.6,0.8);
		}
		else if(Input.GetKey(players[cp,3])){
			rigidbody.velocity = (Vector3.right * inv*velocity);
			boxCollider.size = Vector3(0.5,1.6,0.8);
		}
		else{
			rigidbody.velocity = Vector3.zero;
		}
	}
	else
		{
			WaitForSeconds(1);
			rigidbody.velocity = Vector3.zero;
			Input.ResetInputAxes();
		}
			
		
	


	
	
	
	
	
	
	
	
	
	
	
		
		
}


function OnCollisionEnter(colli : Collision)
{
	rigidbody.velocity = Vector3.zero;
}

function OnCollisionStay(colli : Collision)
{
	rigidbody.velocity = Vector3.zero;
}

