[ create a new paste ] login | about

Link: http://codepad.org/B4Djc6ve    [ raw code | fork ]

C, pasted on Dec 8:
//var enemypos : projectile;

var r_enepos : float;

var e_distance : float;

var e_dis : float;

var ene_hit : la_point;





//var enemy : GameObject;

function OnCollisionEnter(hit : Collision)

{

   randomrange();

   if(hit.gameObject.tag == "cannonball")

   {

   		transform.position = Vector3(r_enepos,2,0);

   		ene_hit.enemyhit();

   		

   }

}

  

function Update()

{

	e_dis = transform.position.x + 21; 

	//Debug.Log("enemy distance" + e_distance);

	

}

   		

function randomrange()

{

	if(Random.Range(0,10)<7)

		r_enepos =  Random.Range(-18,10);

	else

		r_enepos = Random.Range(10,21);

} 		


Create a new paste based on this one


Comments: