// Spawns a layer of stars public void SpawnBackgroundLayer(int count, List<BackgroundStar> List) { for (int i = 0; i < count; i++) { float fade = (float)(r.Next(5) / 200.0f); float alpha = (float)(r.Next(100) / 100.0f); Vector2 pos = new Vector2((float)(r.Next(-100, 1380)), (float)(r.Next(-100, 820))); int ran = r.Next(100); Texture2D text = null; if (ran == 0) { text = Star1; } else if (ran == 1) { text = Star2; } else if (ran == 2) { text = Star3; } else if (ran == 3) { text = Star4; } else if (ran == 4) { text = Star5; } else { text = Star6; } BackgroundStar b = new BackgroundStar(text, pos, fade, alpha); List.Add(b); } }
// Spawns the background liquid particles /*public void SpawnLiquidParticles(int count) { for (int i = 0; i < count; i++) { Vector2 pos = RandomSpawnPosition(1); int ran1 = r.Next(4); Texture2D tex = null; if (ran1 == 0) { tex = Gas1; } else if (ran1 == 1) { tex = Gas2; } else if (ran1 == 2) { tex = Gas3; } else if(ran1 == 3) { tex = Gas4; } Particle p = new Particle(tex, pos); p.Velocity = Vector2.Zero; float rotation = (float)(r.Next(628)) / 100.0f; float ran = (float)r.Next(100) / 400.0f; p.ConstantVelocity = new Vector2(ran * (float)Math.Cos((double)rotation), ran * (float)Math.Sin((double)rotation)); p.Rotation = rotation; p.LiquidParticle = true; // Get a random color int red = r.Next(255); int blue = r.Next(255); int green = r.Next(255); p.color = new Color((byte)red, (byte)green, (byte)blue); LiquidParticles.Add(p); } }*/ // Spawns a group of nebula particles /*public void SpawnNebulaGroup(int count) { // direction choice int ranp = r.Next(2); Vector2 pos = Vector2.Zero; Vector2 vel = Vector2.Zero; if(ranp == 0) { pos = new Vector2(-600, r.Next(720)); vel = new Vector2((float)(r.Next(5, 10) / 10.0f), (float)(r.Next(-2, 2) / 10.0f)); } else if (ranp == 1) { pos = new Vector2(1880, r.Next(720)); vel = new Vector2((float)(r.Next(5, 10) / 10.0f * -1), (float)(r.Next(-2, 2) / 10.0f)); } for (int i = 0; i < count; i++) { Vector2 pos1 = new Vector2(pos.X + r.Next(-10, 10), pos.Y + r.Next(-10, 10)); int ran1 = r.Next(8); Texture2D tex = null; if (ran1 == 0) { tex = Nebula1; } else if (ran1 == 1) { tex = Nebula2; } else if (ran1 == 2) { tex = Nebula3; } else if (ran1 == 3) { tex = Nebula4; } else if (ran1 == 4) { tex = Nebula5; } else if (ran1 == 5) { tex = Nebula6; } else if (ran1 == 6) { tex = Nebula7; } else if (ran1 == 7) { tex = Nebula8; } Particle p = new Particle(tex, pos1); p.Velocity = new Vector2(vel.X, vel.Y); float rotation = (float)(r.Next(628)) / 100.0f; p.Rotation = rotation; p.NebulaParticle = true; // Get a random color int red = r.Next(255); int blue = r.Next(255); int green = r.Next(255); p.color = new Color((byte)red, (byte)green, (byte)blue); LiquidParticles.Add(p); } }*/ // Spawns the backgroung stars public void SpawnBackground(int count) { for (int i = 0; i < count; i++) { int ran = r.Next(15); Texture2D texture; if (ran == 1) { texture = Game1.Global.Star1; } else if (ran == 2) { texture = Game1.Global.Star3; } else if (ran == 3) { texture = Game1.Global.Star4; } else if (ran == 4) { texture = Game1.Global.Star5; } else { ran = r.Next(2); if (ran == 1) { texture = Game1.Global.Star6; } else { texture = Game1.Global.Star2; } } float fade = (float)(r.Next(5) / 200.0f); float alpha = (float)(r.Next(100) / 100.0f); Vector2 pos = new Vector2((float)(r.Next(1280)), (float)(r.Next(720))); BackgroundStar b = new BackgroundStar(texture, pos, fade, alpha); BackgroundStars.Add(b); } }