x


Help me It keeps giving me error Unknown identifier 'Fire'

var Projectile: Transform;
var firerate: float = 0.3;
private var nextFire: float = 0.5;
var Ammo: int = 30;
var empty: boolean = false;

function Update () {

if (Input.GetButton("Fire1")&&Time.time > nextFire)
{
    if(Ammo > 0){
    Fire();
    }
    else{
    return;
    }

}

if(Input.GetKeyUp("r")){
if(empty){
    Reload();
    }
}

if(Ammo <= 0){
    audio.playOnAwake();
empty = true;
}
else{
empty = false;
}

}
fuction Fire(){

audio.PlayOneShot();
    nextFire = Time.time + fireRate;

    var shot = Instantiate(Projectile, transform.position, Quaternion.identity);
    shot.rigidbody.AddForce (transform.forward * 3000);
    Ammo--;
}

fuction OnGUI(){
    GUI.Box (Rect(Screen.width - 100, 20, 100, 80), "");
    GUI.Label (Rect (Screen.width - 100, 35, 90, 20), "Ammo:" + Ammo);
    GUI.Label (Rect (Screen.width - 100, 20, 90, 20), "Health" + PlayerHealth.currentHealth);

if(empty){
GUI.contentColor = Color.red;
GUI.Label (Rect (Screen.width - 100, 50, 90, 20), "RELOAD");

    }
}

@script ExecuteInEditMode()
more ▼

asked Aug 27 '12 at 11:57 PM

zular games gravatar image

zular games
1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
fuction Fire(){

and 

fuction OnGUI(){

should be

function Fire(){

function OnGUI(){
more ▼

answered Aug 28 '12 at 12:00 AM

DaveA gravatar image

DaveA
26.5k 151 171 256

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1951
x19
x17

asked: Aug 27 '12 at 11:57 PM

Seen: 238 times

Last Updated: Aug 28 '12 at 12:00 AM