melonJS
    Preparing search index...

    Class TMXTileMap

    a TMX Tile Map Object Tiled QT +0.7.x format

    Index

    Constructors

    • Parameters

      • levelId: string

        name of TMX map

      • data: object

        TMX map in JSON format

      Returns TMXTileMap

      // create a new level object based on the TMX JSON object
      let level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId));
      // add the level to the game world container
      level.addTo(app.world, true);

    Properties

    backgroundcolor: any
    bounds: any
    class: string

    The map class.

    cols: number

    width of the tilemap in tiles

    height: any
    hexsidelength: number
    infinite: number

    is the map an infinite map

    0
    
    initialized: boolean
    isEditor: boolean
    layers: any[]
    name: string

    name of the tilemap

    nextobjectid: number | undefined
    objectGroups: any[]
    orientation: string

    the map orientation type. melonJS supports “orthogonal”, “isometric”, “staggered”, “hexagonal” and “oblique”.

    orthogonal
    
    renderer:
        | TMXHexagonalRenderer
        | TMXIsometricRenderer
        | TMXOrthogonalRenderer
        | TMXObliqueRenderer
        | undefined
    renderorder: string

    the order in which tiles on orthogonal tile layers are rendered. (valid values are "left-down", "left-up", "right-down", "right-up")

    "right-down"
    
    rows: number

    height of the tilemap in tiles

    skewx: number

    horizontal skew in pixels per tile row (oblique maps, since Tiled 1.12)

    0
    
    skewy: number

    vertical skew in pixels per tile column (oblique maps, since Tiled 1.12)

    0
    
    staggeraxis: any
    staggerindex: any
    tiledversion: string

    The Tiled version used to save the file (since Tiled 1.0.1).

    tileheight: number

    Tile height

    tilesets: TMXTilesetGroup | null | undefined
    tilewidth: number

    Tile width

    version: string

    the TMX format version

    width: any

    Methods

    • add all the map layers and objects to the given container. note : this will not automatically update the camera viewport

      Parameters

      • container: Container

        target container

      • Optionalflatten: boolean

        if true, flatten all objects into the given container, else a me.Container object will be created for each corresponding groups

      • OptionalsetViewportBounds: boolean

        if true, set the viewport bounds to the map size, this should be set to true especially if adding a level to the game world container.

      Returns void

      // create a new level object based on the TMX JSON object
      let level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId));
      // add the level to the game world container
      level.addTo(app.world, true, true);
    • Return an Array of instantiated objects, based on the map object definition. Objects are created using the Tiled object factory registry, which dispatches to the appropriate factory based on the object's class, name, or structure. Custom factories can be registered via registerTiledObjectFactory or registerTiledObjectClass.

      Parameters

      • Optionalflatten: boolean

        if true, flatten all objects into the returned array. when false, a me.Container object will be created for each corresponding groups

      Returns Renderable[]

      Array of Objects