2.0.9 • Published 4 years ago

tiled-tmx-parser v2.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Tiled TMX Parser

Loads tmx and tsx files created by the Tiled Map Editor. Works with both embedded and referenced tilesets.

https://www.mapeditor.org/

Examples

Load by URI

import {parse} from 'tiled-tmx-parser';

async function loadMap() {
    // Must be an absolute uri
    const map = await parse('http://{YOUR_SITE}/my-map.tmx');
}

Load by path

import {parse} from 'tiled-tmx-parser';

async function loadMap() {
    // Must be an absolute uri
    const map = await parse(path.join(__dirname, './maps/my-map.tmx');
}

API

import {parse} from 'tiled-tmx-parser';

async function loadMap() {
    // Must be an absolute uri
    const map = await parse(path.join(__dirname, './maps/my-map.tmx');
    const tileLayer = map.layers.find(x => x instanceof TileLayer) // as TileLayer;
    const firstTile = tileLayer.tileAt(0, 0);
    const firstObject = map.getObjectById(1);
    const firstTileInTileSet = map.getTileById(1);
    const firstTileSet = map.getTileSetByGid(1);
}

Options

KeyDescriptionDefaultValue
transformObjectPropertiesWhether or not to transform "object" custom properties into a reference of the object. If set to false, a number is used as the custom property.true

Notes

  • Does not support Base64 ZStandard compression
  • Does not support "Output Chunk Width/Height"
  • Does not currently support Group Layer
2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.4

4 years ago

2.0.6

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.6.4

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago