private static Level LoadLevel(string data, GameControl gc, Image[,] iset) { data = data.Replace("\r", ""); Level level = new Level(gc); int row = 0; int key = 0; foreach (String s in data.Split("\n".ToCharArray())) { for (int i = 0; i < s.Length; i++) { if (s.ToCharArray()[i] == '1') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[0, 0])); } if (s.ToCharArray()[i] == '2') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[1, 0])); } if (s.ToCharArray()[i] == '3') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[2, 0])); } if (s.ToCharArray()[i] == '4') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[3, 0])); } if (s.ToCharArray()[i] == '5') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[4, 0])); } if (s.ToCharArray()[i] == '6') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[5, 0])); } if (s.ToCharArray()[i] == '7') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[6, 0])); } if (s.ToCharArray()[i] == '8') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[7, 0])); } if (s.ToCharArray()[i] == '9') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[8, 0])); } if (s.ToCharArray()[i] == 'Q') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[0, 8])); } if (s.ToCharArray()[i] == 'W') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[1, 8])); } if (s.ToCharArray()[i] == 'E') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[2, 8])); } if (s.ToCharArray()[i] == 'R') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[3, 8])); } if (s.ToCharArray()[i] == 'S') { level.AddSprite(new FloorTile(new Point(i * 128, row * 128), key, iset[0, 9])); } if (s.ToCharArray()[i] == 'B') { level.AddSprite(new BounceTile(new Point(i * 128, row * 128), key, iset[6, 8])); } if (s.ToCharArray()[i] == 'C') { level.AddSprite(new SpikeTile(new Point(i * 128, row * 128), key, iset[7, 8])); } if (s.ToCharArray()[i] == 'D') { level.AddSprite(new Door(new Point(i * 128, row * 128), key, iset[5, 8], iset[4, 8])); } if (s.ToCharArray()[i] == 'p') { level.AddSprite(new Donut(new Point(i * 128, row * 128), key)); } key++; } row++; } return(level); }