Class TMXTileMap

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

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(me.game.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: undefined | number
objectGroups: any[]
orientation: string

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

"orthogonal"
renderer:
    | undefined
    | TMXOrthogonalRenderer
    | TMXIsometricRenderer
    | TMXHexagonalRenderer
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

staggeraxis: any
staggerindex: any
tiledversion: string

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

tileheight: number

Tile height

tilesets: undefined | null | TMXTilesetGroup
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(me.game.world, true, true);
  • return an Array of instantiated objects, based on the map object definition

    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