private void AddStar(float getPosX, float getDirX) { Random Rand = new Random(); int RandNum = Rand.Next(6, 11); Background_effects star = new Background_effects(Content, "graphics/starss", RandNum, RandNum, 1, 2); star.Position = new Vector2(getPosX, -100); star.Direction = new Vector2(getDirX, 800) - star.Position; star.Direction.Normalize(); Random Rand2 = new Random(); float RandNum2 = Rand2.Next(2, 5); star.Speed = RandNum2; StarList.Add(star); }
private void AddNebula() { Background_effects Nebula = new Background_effects(Content, "graphics/background_nebula", ScreenSize.X / 2, ScreenSize.Y / 2, 4, 4); Random Rand2 = new Random(); int RandNum2 = Rand2.Next(-ScreenSize.X / 2, ScreenSize.X * 2 / 2); Nebula.Position = new Vector2(RandNum2, -ScreenSize.Y / 2); Nebula.Direction = new Vector2(RandNum2, ScreenSize.Y * 2) - Nebula.Position; Nebula.Direction.Normalize(); Nebula.Speed = 3f; Random Rand = new Random(); int RandNum = Rand.Next(1, 17); Nebula.SpriteAnim.currentFrame = RandNum; NebulaList.Add(Nebula); }
private void AddPlanet() { Random Rand = new Random(); int RandNum = Rand.Next(100, 400); Background_effects Planet = new Background_effects(Content, "graphics/background_planet3", RandNum, RandNum, 1, 3); Random Rand2 = new Random(); int RandNum2 = Rand2.Next(-ScreenSize.X + ScreenSize.X, ScreenSize.X); Planet.Position = new Vector2(RandNum2, -ScreenSize.Y / 2); Planet.Direction = new Vector2(RandNum2, ScreenSize.Y * 2) - Planet.Position; Planet.Direction.Normalize(); Planet.Speed = 1.5f; Random Rand3 = new Random(); int RandNum3 = Rand3.Next(0, 3); Planet.SpriteAnim.currentFrame = RandNum3; PlanetList.Add(Planet); }