Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

fireRate javascript?

$
0
0
I'm making a miniagme, were, you can shoot. I use this Firerate stript, and I don't know why it doesn't work: the scene start, I shot one time, and the x become equal to 0.511. I don't know why it doens't works! can you help me please? this is an example, like my real script: #pragma strict var spownPoint : Transform; var bullet : GameObject; var bool : boolean; var force : int=1000; var x : GameObject; var z : float; var y :float; function Start () { } function Update () { if(Input.GetKey(KeyCode.E)&&Time.deltaTime>z) { z = Time.deltaTime+y; shot(); } } function shot() { var x = Instantiate(bullet, spownPoint.position, spownPoint.rotation); x.GetComponent.().AddForce(x.transform.forward*forza); }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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