#pragma strict
// This function gets called ~60 times per second
public var DactylSpeed : int = 10;
public var lives : int = 5;
function Update() {  
    // GetAxis() returns a value between 1 and -1
    // Depending on which arrow key is pressed

    // So we change the spaceship X and Y velocity
    // By GetAxis("Horizontal") * 10
    // And By GetAxis("Vertical") * 10
    // allows player character to move
    GetComponent.<Rigidbody2D>().velocity.x = Input.GetAxis("Horizontal") * DactylSpeed;
   	GetComponent.<Rigidbody2D>().velocity.y = Input.GetAxis("Vertical") * DactylSpeed;
  
}
//destroys the pteradactyl when hit
function OnTriggerEnter2D(obj: Collider2D)
{
 //if (isfriendly = 1)
//	{
//	Physics.IgnoreCollision(collision.collider, collider);
//	}
if (lives > 0)
	{
	lives = lives - 1;
	}	
	
else
	{
	GameObject.Destroy(gameObject);
	
	}
}

