Hi,
I am trying to make a gun shoot 14 bullets a second. I have tried many codes, but the only that will shoot at all. One will shoot one bullet every frame, and the other will shoot one bullet a second. My question is, what should my code be (in Javascript) to make a game object emit 14 bullets a second when I click the primary click button on my mouse.
My codes are:
this one shoots once per frame
var bullet : GameObject;
function Update(){
if(Input.GetAxis("Fire1")){
Instantiate(bullet, transform.position, transform.rotation);
}
}
This one shoots once per click
var bullet : GameObject;
function Update(){
if(Input.GetButtonDown("Fire1")){
Instantiate(bullet, transform.position, transform.rotation);
}
}
↧