private WorldLoader makeWorld(List <ChallengeStats> blockStats, Size realityBubbleSize) { double worldHeight = 2000; double worldWidth = 0; foreach (ChallengeStats stats in blockStats) { worldWidth += stats.Width; } Size size = new Size(worldWidth, worldHeight);; WorldLoader worldLoader = new WorldLoader(size, realityBubbleSize); double blockX = 0; Dictionary <int, WeaponStats> weaponsByLevel = new Dictionary <int, WeaponStats>(); foreach (ChallengeStats stats in blockStats) { double blockWidth = stats.Width; int numEnemies = stats.NumEnemies; BasicWeapon basicWeapon = new BasicWeapon(); int weaponLevel = (int)stats.EnemyWeaponLevel; if (!weaponsByLevel.ContainsKey(weaponLevel)) { weaponsByLevel[weaponLevel] = this.makeWeapon(weaponLevel); } WeaponStats weaponStats = weaponsByLevel[weaponLevel]; for (int i = 0; i < stats.NumEnemies; i++) { double enemyX = this.randomGenerator.NextDouble() * blockWidth + blockX; double enemyY = this.randomGenerator.NextDouble() * worldHeight / 4; int enemyIntelligence = (int)stats.EnemyIntelligence; enemyIntelligence = Math.Max(Math.Min(enemyIntelligence, 1), 0); double enemyHitpoints = stats.EnemyHitpoints; Enemy enemy = new Enemy(ImageLoader.loadImage("archer.png"), new Point(enemyX, enemyY), new GameRectangle(26, 41), new double[] { stats.EnemyAcceleration, 0 }, stats.EnemyHitpoints, 950, enemyIntelligence); worldLoader.addItem(enemy); } blockX += blockWidth; } return(worldLoader); }