Table of Contents

Class Map

Namespace
DotTiled
Assembly
DotTiled.dll

Represents a Tiled map.

public class Map : HasPropertiesBase, IHasProperties
Inheritance
Map
Implements
Inherited Members

Properties

BackgroundColor

The background color of the map.

public TiledColor BackgroundColor { get; set; }

Property Value

TiledColor

Class

The class of this map.

public string Class { get; set; }

Property Value

string

CompressionLevel

The compression level to use for tile layer data (defaults to -1, which means to use the algorithm default). Typically only useful for parsing, but may be interesting for certain use cases.

public int CompressionLevel { get; set; }

Property Value

int

Height

The height of the map in tiles.

public required int Height { get; set; }

Property Value

int

HexSideLength

Only for hexagonal maps. Determines the width or height (depending on the staggered axis) of the tile's edge, in pixels.

public Optional<int> HexSideLength { get; set; }

Property Value

Optional<int>

Infinite

Whether this map is infinite. An infinite map has no fixed size and can grow in all directions. Its layer data is stored in chunks.

public bool Infinite { get; set; }

Property Value

bool

Layers

Hierarchical list of layers. Group is a layer type which can contain sub-layers to create a hierarchy.

public List<BaseLayer> Layers { get; set; }

Property Value

List<BaseLayer>

NextLayerID

Stores the next available ID for new layers. This number is used to prevent reuse of the same ID after layers have been removed.

public required uint NextLayerID { get; set; }

Property Value

uint

NextObjectID

Stores the next available ID for new objects. This number is used to prevent reuse of the same ID after objects have been removed.

public required uint NextObjectID { get; set; }

Property Value

uint

Orientation

Map orientation.

public required MapOrientation Orientation { get; set; }

Property Value

MapOrientation

ParallaxOriginX

X coordinate of the parallax origin in pixels.

public float ParallaxOriginX { get; set; }

Property Value

float

ParallaxOriginY

Y coordinate of the parallax origin in pixels.

public float ParallaxOriginY { get; set; }

Property Value

float

Properties

Map properties.

public List<IProperty> Properties { get; set; }

Property Value

List<IProperty>

RenderOrder

The order in which tiles on tile layers are rendered.

public RenderOrder RenderOrder { get; set; }

Property Value

RenderOrder

StaggerAxis

For staggered and hexagonal maps, determines which axis (X or Y) is staggered.

public Optional<StaggerAxis> StaggerAxis { get; set; }

Property Value

Optional<StaggerAxis>

StaggerIndex

For staggered and hexagonal maps, determines whether the "even" or "odd" indexes along the staggered axis are shifted.

public Optional<StaggerIndex> StaggerIndex { get; set; }

Property Value

Optional<StaggerIndex>

TileHeight

The height of a tile.

public required int TileHeight { get; set; }

Property Value

int

TileWidth

The width of a tile.

public required int TileWidth { get; set; }

Property Value

int

TiledVersion

The Tiled version used to save the file.

public Optional<string> TiledVersion { get; set; }

Property Value

Optional<string>

Tilesets

List of tilesets used by the map.

public List<Tileset> Tilesets { get; set; }

Property Value

List<Tileset>

Version

The TMX format version. Is incremented to match minor Tiled releases.

public required string Version { get; set; }

Property Value

string

Width

The width of the map in tiles.

public required int Width { get; set; }

Property Value

int

Methods

GetProperties()

The properties attached to the object.

public override IList<IProperty> GetProperties()

Returns

IList<IProperty>

ResolveTilesetForGlobalTileID(uint, out uint)

Resolves which tileset a global tile ID belongs to, and returns the corresponding local tile ID.

public Tileset ResolveTilesetForGlobalTileID(uint globalTileID, out uint localTileID)

Parameters

globalTileID uint

The global tile ID to resolve.

localTileID uint

The local tile ID within the tileset.

Returns

Tileset

The tileset that contains the tile with the specified global tile ID.

Exceptions

ArgumentException

Thrown when no tileset is found for the specified global tile ID.