- Home /
Question by
tss · Mar 25, 2013 at 04:39 PM ·
javascriptshootingbulletbasic
Rapid fire Help
Hi. I am making a game where i heed to hold the space bar down and shoots lots of bullets at once and emit a particle. here is my script feel free to add on to it or leave any useful information. Thanks.(its a java script).
if(Input.GetButtonDown("Jump"))
{
var bullit = Instantiate
(bullitPrefab,GameObject.Find("spawnPoint").transform.position,Quaternion.identity);
bullit.tag = "wormProjectile";
bullit.rigidbody.AddForce(transform.forward * 2000);
}
Comment
Best Answer
Answer by Graham-Dunnett · Mar 25, 2013 at 08:32 PM
Read the docs:
http://docs.unity3d.com/Documentation/ScriptReference/Input.GetButton.html
GetButton is used for rapid fire. GetButtonDown will only get called once when the button is pressed.