added the ability to change the tiles collection at runtime

This commit is contained in:
Dylan Wilson
2018-11-17 22:09:10 +10:00
parent 0a8577f77f
commit 8ab5e384ec
2 changed files with 7 additions and 9 deletions
@@ -219,7 +219,7 @@ namespace MonoGame.Extended.Tiled
var tileHeight = map.TileHeight;
var tileCount = reader.ReadInt32();
var tiles = new TiledMapTile[width * height];
var layer = new TiledMapTileLayer(name, width, height, tileWidth, tileHeight, offset, opacity, isVisible);
for (var i = 0; i < tileCount; i++)
{
@@ -227,10 +227,10 @@ namespace MonoGame.Extended.Tiled
var x = reader.ReadUInt16();
var y = reader.ReadUInt16();
tiles[x + y * width] = new TiledMapTile(globalTileIdentifierWithFlags, x, y);
layer.Tiles[x + y * width] = new TiledMapTile(globalTileIdentifierWithFlags, x, y);
}
return new TiledMapTileLayer(name, width, height, tileWidth, tileHeight, tiles, offset, opacity, isVisible);
return layer;
}
}
}