I'm editing this map editor http://xnafan.net/2013/01/2d-map-generation-for-xna/ to suit the needs of a game I'm trying to make. The map as it stands, generates random points in a 50x50 map and right clicking smooths out the points to make a hilly texture.
What I'm trying to do is edit it so that I can set my own points at each square individually, and currently the program doesnt allow you to do this. I figured out how to set all points to zero, but I don't know how to set each point individually. I there a way that I can create a border around the map 10 blocks in width and set them all to 50? The editor will do the rest and smooth them out to look like hills
The editor also exports maps as a text file, but only with spaces and x's. I want to export the map with numbers representing the height of the square.
for (int y = 0; y < map.GetLength(1); y++)
{
//first element in a row has no comma in front of it
string separator = "";
for (int x = 0; x < map.GetLength(0); x++)
{
//write simple "X" if the map is above oceanlevel or a space otherwise
builder.Append(separator + (map[x, y] > oceanLevel ? "X" : " "));
//all remaining elements in row have a comma before them
separator = ",";
}
//add a new line
builder.AppendLine();
}
try
{
//write the save game file.
using (StreamWriter writer = File.CreateText(path)) { writer.Write(builder.ToString()); }
}
catch (Exception ex)
{
throw new Exception("Error writing to file '" + path + "'. Error is: " + ex.ToString());
}
}
Could I alter the for loops to look at each block and read the height that its set to?