// W LoadContent() LoadLevel("Level1.xml"); // W Draw protected void LoadLevel(string levelName) { using (FileStream fs = File.OpenRead("Levels/" + levelName)) { XmlSerializer serializer = new XmlSerializer(typeof(Level)); level = (Level)serializer.Deserialize(fs); } // Generate blocks based on level.layout array for (int i = 0; i < level.layout.Length; i++) { for (int j = 0; j < level.layout[i].Length; j++) { if (level.layout[i][j] != 9) { Block tempBlock = new Block((BlockColor)level.layout[i][j], this); tempBlock.LoadContent(); tempBlock.position = new Vector2(64 + j * 64, 100 + i * 32); blocks.Add(tempBlock); } } } } protected void NextLevel() { // Add points AddScore(5000 + 5000 * speedMult + 500 * (balls.Count - 1) * speedMult); balls.Clear(); powerups.Clear(); paddle.position = new Vector2(512, 740); StartLevelBreak(); // Disable powerups ballCatchActive = false; paddle.ChangeTexture("paddle"); if (level.nextLevel == "Level1.xml") { speedMult++; } LoadLevel(level.nextLevel); levelNumber++; }