Skip to content

Instantly share code, notes, and snippets.

@AidanBurke
Created September 27, 2012 22:14
GetLevelData Method part 1
void LoadMapData(string name)
{
string path = "MapLayouts/" + name + ".txt";
// Width and height of our tile array
int width = 0;
int height = File.ReadLines(path).Count();
StreamReader sReader = new StreamReader(path);
string line = sReader.ReadLine();
string[] tileNo = line.Split(',');
width = tileNo.Count();
// Creating a new instance of the tile map
tileMap = new int[height, width];
sReader.Close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment