Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

Change Gun Fire Rate

$
0
0
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); } }

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>