LoadTiledMap
Category: Tiled Maps (Pro)
Signature
LoadTiledMap(fileName As String)
Returns
TiledMap
Description
Loads a Tiled map file and returns a TiledMap object with nested layers, objects, tilesets, and properties.
Use standard member and array access (for example: map.LayerCount, map.Layers[i], layer.Objects[j]).
Lifetime
When you are done with a loaded map, release it with Free map.
Do not free nested values like layers, objects, tilesets, or properties individually; they are owned by the parent map object and are released automatically when the map is freed.
Built-in Structures
TiledMap fields: Width, Height, TileWidth, TileHeight, Type, Orientation, Infinite, Layers, LayerCount, Tilesets, TilesetCount, Properties, PropertyCount.
TiledLayer fields: Name, Type, Width, Height, Tiles, TileCount, Objects, ObjectCount, Properties, PropertyCount.
TiledObject fields: Id, Visible, Name, Type, X, Y, Width, Height, Properties, PropertyCount.
TiledTileset fields: Name, Type, FirstGid, TileCount, TileWidth, TileHeight, Properties, PropertyCount.
TiledProperty fields: Name, Type, Value.
Pro feature: compiling code that uses LoadTiledMap requires a license with the Tiled feature enabled.
Example
Dim map As TiledMap
Dim layer As TiledLayer
map = LoadTiledMap("assets/maps/level1.tmx")
If map <> Null Then
DebugPrint "Layers: " + Str(map.LayerCount)
If map.LayerCount > 0 Then
layer = map.Layers[0]
DebugPrint "First layer: " + layer.Name
End If
Free map
End If