does anyone see any problems? i can’t seem to find any
there are 3 errors at 35,10 35,20 and 36,7 but the script looks fine there?
var stopDist = 0;
var sPeed = 10;
var armTime = 1;
var armed = 0;
var stop = 0;
var explosion : GameObject;
var hit: RaycastHit;
var ray;
private var target : Transform;
function Start () {
Invoke("isArmed", armTime);
}
function Update () {
var dist = Vector3.Distance(target.position, transform.position);
transform.Translate(Vector3.forward * Time.deltaTime * sPeed);
if(dist <= stopDist){
stop = 1;
}
if(dist >= stopDist){
if(armed == 1){
if(stop == 0){
transform.LookAt(target);
}
}
}
if(Input.GetMouseButtonDown(0)) {
if (Physics.Raycast (ray, hit, 100)) {
target = hit.collider.gameObject;
}
}
function isArmed () {
armed = 1;
}
function OnCollisionEnter () {
Destroy(gameObject);
Instantiate(explosion, transform.position, Quaternion.identity);
}