How do I create bullet patterns (multiple bullets, different world positions)

Hi,

I'm trying to create enemies that create bullet hell shooter patterns. These require multiple bullets to be fired in circular or arc patterns at once. My simple question is what is the best way to go about this?

should I:

1) Script an enemy with multiple bullet "gameobject" and then instantiate them in code, once the player is close?

2) Should I put all bullet objects into one prefab and then instantiate that prefab in code. (I tried this, and for some reason, prefabs don't like object with duplicate names.)

Not sure if either of these is the best way. But neither has worked properly. Option 1 creates two bullets in the same position; which makes it look like just one bullet has instantiated.

I appreciate any input you have. Please let me know if clarity is required.

This piece of code will do it. It's not fancy but it does the job.

var bullet : Transform;
var bulletAmount : float = 8;
private var bulletcoords : Vector2;
private var rot : Quaternion;

function Start()
{
    for (var i : float = 0; i<bulletAmount; i++)
    {
        rot.eulerAngles = Vector3(0,270+((i/bulletAmount)*180),0);
        Instantiate(bullet, Vector3.zero, rot);
    }
}

What I discovered while coding this is that my variables needed to be `float`s, not `int`s; otherwise the division of `i/bulletAmount` doesnt work.

http://unity3d.com/support/documentation/ScriptReference/Quaternion-eulerAngles.html

You could have a "shooter" game object that is just an empty game object that sits where the bullets appear from.

Instantiate a bullet each frame and rotate the object by some amount using rotate

Keep firing and rotating for as many frames as you want to fire for.

You can also use for loops to fire and rotate multiple times in a single frame.

I am learning code, i wanted to figure how to make the bullets change position as well as rotation, the answer was to change the instantiate line to:

Instantiate(bullet, Vector3(0, i ,0), rot);