- Home /
This question was
closed Apr 11, 2013 at 04:42 PM by
Loius for the following reason:
Duplicate Question
Question by
Purpleshine84 · Apr 11, 2013 at 04:24 PM ·
javascripterror
Fix this error on line 28: expecting EOF
public var bulletPrefab : Transform;
public var bulletSpeed : float = 6000;
var ammo : int = 60;
var GunShot : AudioClip;
var reload : AudioClip;
var emptyClip : boolean = false;
function Update () {
if(Input.GetButtonDown("fire1")) {
if(ammo > 0) {
Shoot() ;
}
else {
return;
}
}
if (input.GetKeyDown (KeyCode.R)
)if (emptyClip) ;
Reload() ;
}
}
if (ammo > 0) {
emptyClip = true;
}
else {
emptyClip = false;
}
function Shoot() {
var Bullet = Instantiate(BulletPrefab, transform.Find("BulletSpawn").position, transform.Find("BulletSpawn").rotation );
bullet.Rigidbody.AddForce(transform.forward * bulletSpeed);
audio.PlayOneShot (gunShot) ;
ammo--;
}
function Reload() {
audio.PlayOneShot(reload);
ammo = 60;
}
function onGUI() {
GUI.label (Rect ( 0,0, 75, 25), "Ammo" + ammo) ;
}
Hi Guys, I am new to Unity and Javascript and got this script from youtube, but it doesnt seem to work. Any help? Thanks in Advance,
Maurice
Comment