hi i’m going through a tutorial (- YouTube) but i’m having problems even though i’ve followed the tutorial correctly.
heres the code
#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 != null){
if (collided_with.tag == "Left"){
return;
}
}
transform.Translate(Vector3(1 * speed * Time.deltaTime, 0, 0));
}
if(Input.GetAxis("Horizontal") < 0){
if (collided_with != null){
if (collided_with.tag == "Right"){
return;
}
}
transform.Translate(Vector3(-1 * speed * Time.deltaTime, 0, 0));
}
}
function OnCollisionEnter(col : Collision){
collided_with = col.gameObject;
}
function OnCollisionExit(col : Collision){
collided_with = null;
}
i have 3 errors they are :
Assets/Scripts/player_Script.js(13,43): BCE0019: ‘tag’ is not a member of ‘System.Type’.
Assets/Scripts/player_Script.js(22,43): BCE0019: ‘tag’ is not a member of ‘System.Type’.
Assets/Scripts/player_Script.js(31,29): BCE0022: Cannot convert ‘UnityEngine.GameObject’ to ‘System.Type’.
any help is appreciated