The NameTileOrderedIndexes property can be used to find tiles by a given name. It is a Dictionary<string, List<int>> , where the key is a name, and the value is the index of tiles which have the given name.
The MapDrawableBatch object stores a list of vertices (points) which are used to define the coordinates for each tile. These points are used by the rendering code in the MapDrawableBatch class to perform efficient rendering. Each tile is composed of a list of vertices, as opposed to a Sprite (as might be the case if the MapDrawableBatch were a FlatRedBall-drawn object). Therefore, to access and modify properties on a tile, its index must be known. The following image shows the indexes of a simple tile map:
The following code example shows how to create an Entity for every tile with the name "CreateEntity".
Tiles will only have properties at runtime if it uses a tile in a tileset with a Name property.
Tiles in a Tiled map have names at runtime if any of the following conditions apply:
If the name has been given explicitly to the tile
If the Tile has any other custom properties (will be automatically named)
If the Tile has a Class
For example, a typical FlatRedBall project includes a tileset named StandardTileset.tsx with tiles for common TileShapeCollision creation such as SolidCollision.
The SolidCollision tile does not have a Name property, so it is assigned an automatic name at runtime as shown in the following screenshot of Visual Studio showing the names of the tiles in a typical map:
Notice that in this case the names are TiledIcons0_autoname and TiledIcons43_autoname. The names correspond to the IDs in the Tileset.