private void GenerateGameScene() { string text = File.ReadAllText("FlappyMap.txt"); string[] mapText = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < mapText.Length; i++) { for (int j = 0; j < mapText[i].Length; j++) { GameElement element; if (mapText[i][j] == 'w') { this.player = new PlayerElement(); element = this.player; } else if (mapText[i][j] == '@') { element = new ObstacleElement(); } else { element = new EmptySpaceElement(); } element.Row = i; element.Column = j; gameElements.Add(element); } } }
private void GenerateGameScene() { string text = File.ReadAllText("FlappyMap.txt"); string[] mapText = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < mapText.Length; i++) { for (int j = 0; j < mapText[i].Length; j++) { GameElement element; if (mapText[i][j] == 'w') { this.player = new PlayerElement(); element = this.player; } else if (mapText[i][j] == '@') { element = new ObstacleElement(); } else { element = new EmptySpaceElement(); } element.Row = i; element.Column = j; gameElements.Add(element); } } }