melonJS
    Preparing search index...

    Function getTMX

    The older name of getTileMap, from when a Tiled map was the only kind of tile map: the same function.

    since 20.18.0, use getTileMap

    the asset name

    the parsed map or tileset, or null if none is loaded under that name

    • Get a loaded tile map or tileset (a "tmx", "tilemap", "spritefusion" or "tsx" asset) as parsed data: the map's JSON structure, whether it was loaded from XML or JSON. A Sprite Fusion map.json is kept as the file has it (tileSize, mapWidth, mapHeight, layers). Most code never needs it: level.load(name) builds the level from it.

      Parameters

      • elt: string

        the asset name

      Returns object

      the parsed map or tileset, or null if none is loaded under that name

      const map = loader.getTileMap("map1");
      console.log(map.width, map.height, map.layers.length);