Hi, I have this piece of code, however it has three errors which i cannot solve
private var bombspeed : float= -4f;
function Update () : void
{
transform.Translate( new Vector3(0f, bombspeed*Time.deltaTime, 0f) );
if (transform.position.y < -11)
{
Destroy(this.gameObject);
}
function OnTriggerEnter (Collider other ) : void
{
if (other.gameObject.name == "Shark")
{
gameObject.transform.rotation = Quaternion.identity;
gameObject.transform.position = new Vector3(20f, -3f, 8f);
Destroy(this.gameObject);
}
}
}
the problem lies in this part
function OnTriggerEnter (Collider other ) : void
and the errors are:
Assets/Scripts/Bomb.js(11,18): BCE0044: expecting (, found 'OnTriggerEnter'.
Assets/Scripts/Bomb.js(11,43): BCE0044: expecting ), found 'other'.
Assets/Scripts/Bomb.js(11,49): BCE0043: Unexpected token: ).
can anyone direct me on what am doing wrong?