var fireTimer : float = 0;
var bullet : Transform;
var force : float = 2000;
var CrossbowShot : AudioClip;
var fireState : float = 1;
function Update()
{
if(Input.GetButtonDown("Fire1"))
{
if (fireState == 1);
{
audio.PlayOneShot(CrossbowShot);
var bullet = Instantiate(bullet,
GameObject.Find("shotPos").transform.position,
GameObject.Find("shotPos").transform.rotation);
bullet.rigidbody.AddForce(bullet.transform.forward * force);
var fireTimer = 0;
}
fireTimer = Time.deltaTime;
if (fireTimer >= 1)
fireTimer = 1;
fireState = 1;
}
/// "
}
Every once in a while something completely stupid will happen when i code, one of them being that i get this error: 'Assets/Scripts/PlayerGunShooting.js(18,32): BCE0044: expecting :, found ';'.
The stupid thing is that whenever i do actually change the ; to a , the error will say that it expects ',' but it found ','. DOES ANYBODY KNOW HOW TO FIX THIS CODE?
PS: i know that this code is probably horrible and saddening to all of you pro or semi-pro coders but i'm new to coding and am obviously not very proficient.
Thanks for the answer, it worked :)
↧