#pragma strict
var health : int = 100;
var speed : int = 5;
var collided_with : GameObject;
function Start () {
}
function Update () {
if(Input.GetAxis("Horizontal") >0 ){
if (collided_with.tag == "left"){
return;
}
transform.Translate(Vector3(1 * speed * Time.deltaTime,0,0));
}
if(Input.GetAxis("Horizontal") <0){
if (collided_with.tag == "right"){
return;
}
transform.Translate(Vector3(-1 * speed * Time.deltaTime,0,0));
}
}
function OnCollitionInter(col : Collision ){
collided_with = col.gameObject;
}
You need to spell the name correctly.
function OnCollisionEnter(col : Collision)
NOT
function OnCollitionInter(col : Collision ){