ABove you’ll see my probelm, i’ve been creating a 2d scrolling shooter for some time, however I’ve come to a problem with my bullets, and how they’re instantiated.
When runnning and holding down space they show no signs of movement, and turn into a spaced out string of bullets, needless to say this doesn’t work, and I’m all out of ideas…
/*if(Input.GetKey("space")){
var tempBullet: Rigidbody;
tempBullet = Instantiate(bullet, transform.position, transform.rotation);*/
The above is my commented out code for instantiating single bullets, but realising i need to hold to fire, that quickly got negated.
Below is my current code, where things have clearly nto quite qorked
if (Input.GetKey ("space") && Time.time > nextFire) {
nextFire = Time.time - fireRate;
var clone = Instantiate (bullet, transform.position, Quaternion.Euler(0, 0, 0));
var tempShotsound = Instantiate(shot, transform.position, transform.rotation);
}
Any ideas are greatly appreciated!