I’m in the process of making a bullet hell style game. I’ve used a variation of the Laser Defender tutorials firing methods and right now I have the bullets spawning where I want them but each pattern is restricted to the enemies origin. Here’s the code
void Fire()
{
Vector3 startPosition = transform.position + new Vector3(5, -7f, 0);
GameObject missile = Instantiate(projectile, startPosition, Quaternion.identity) as GameObject;
missile.GetComponent().velocity = new Vector2(10, -projectileSpeed);
Vector3 startPosition2 = transform.position + new Vector3(-5, -7f, 0);
GameObject missile2 = Instantiate(projectile, startPosition2, Quaternion.identity) as GameObject;
missile2.GetComponent<Rigidbody2D>().velocity = new Vector2(-10, -projectileSpeed);
Vector3 startPosition3 = transform.position + new Vector3(0, -7f, 0);
GameObject missile3 = Instantiate(projectile, startPosition3, Quaternion.identity) as GameObject;
missile3.GetComponent<Rigidbody2D>().velocity = new Vector2(0, -projectileSpeed);
As you can see there’s 3 points where the bullets come from but they fall in a linear pattern so its pretty easy to just stay in between the bullets. Any way to add a random variable to have them a little more scattered?