Multiple projectiles

Hey guys,

I’m working on a top down shooter kind of game, and I have it set so the player collects money and can spend it at upgrade stations. So far I can upgrade playerspeed, fire rate, and things like laser sights and stuff. But I want to add an upgrade that increases how many shots you fire at once. So, normally the character is shooting one projectile per click, but I want to make it so with the upgrade, when you click it will shoot from 2 to 6 projectiles in a fan pattern depending on how far you upgrade. But how can I get it so when a variable is a certain number, it shoots 2 to six in a fan pattern. Is it possible to do this from one object, or am I going to need to clone my shooting object and just enable them as I upgrade?

Thanks

Anyone?

Actually this depends on the code you already have and how you manage to fire the projectiles. Usually it should not be a problem though and can be done in one script. You’ll just need to Instantiate the correct amount of projectiles, give them the correct rotation (the pattern is up to you) and add e.g. a force.

yeah! ^ if you already have a projectile script then just wrap it with this, and figure out a way to add the fan effect.

c#, i hate UnityScript

public int howmanyshots = 2;


public void multipleShots(){
     for (int i=0; i < howmanyshots; i++){

     //projectile part here

     }
}

Wrote that while eating pizza so if it sucks too much dont use it, itd be easier to see the original code to work with it rather than just writing up a quick usage.