Open Brett208 opened 4 years ago
Good idea.
The tiles are stored in columns, each 32 tiles wide. You end up with an array of columns, where each column is stored in normal array order.
Conceptually it's a bit like:
numColumns = mapWidth / 32;
TileData tileData[numColumns][mapHeight][32];
columnIndex = x / 32;
columnX = x % 32;
auto tile = tileData[columnIndex][y][columnX];
Could we add more detail to the Map class explaining how tile indexing works? It could be placed in the map header or within the GetTileIndex function.
I wanted to write a function that allows changing the map size dynamically, but to do that, I need to understand the indexing better.