Skip to main content
Version: Phaser v3.88.2

Types.Tilemaps

CreateFromObjectLayerConfig

<static> CreateFromObjectLayerConfig

nametypeoptionaldescription
idnumberYesA unique Object ID to convert.
gidnumberYesAn Object GID to convert.
namestringYesAn Object Name to convert.
typestringYesAn Object Type to convert.
classTypefunctionYesA custom class type to convert the objects in to. The default is {@link Phaser.GameObjects.Sprite}. A custom class should resemble Sprite or Image; see {@link Phaser.Types.Tilemaps.CreateFromObjectsClassTypeConstructor}.
ignoreTilesetbooleanYesBy default, gid-based objects copy properties and respect the type of the tile at that gid and treat the object as an override. If this is true, they don't, and use only the fields set on the object itself.
scenePhaser.SceneYesA Scene reference, passed to the Game Objects constructors.
containerPhaser.GameObjects.ContainerYesOptional Container to which the Game Objects are added.
keystring | Phaser.Textures.TextureYesOptional key of a Texture to be used, as stored in the Texture Manager, or a Texture instance. If omitted, the object's gid's tileset key is used if available.
framestring | numberYesOptional name or index of the frame within the Texture. If omitted, the tileset index is used, assuming that spritesheet frames exactly match tileset indices & geometries -- if available.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/CreateFromObjectLayerConfig.js#L1
Since: 3.50.0


CreateFromObjectsClassTypeConstructor

<static> CreateFromObjectsClassTypeConstructor

Type: function

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/CreateFromObjectsClassTypeConstructor.js#L1
Since: 3.60.0


DebugStyleOptions

<static> DebugStyleOptions

nametypeoptionaldefaultdescription
styleConfig.tileColorPhaser.Display.ColorYes"blue"Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn.
styleConfig.collidingTileColorPhaser.Display.ColorYes"orange"Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn.
styleConfig.faceColorPhaser.Display.ColorYes"grey"Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/DebugStyleOptions.js#L1
Since: 3.0.0


FilteringOptions

<static> FilteringOptions

nametypeoptionaldefaultdescription
isNotEmptybooleanYesfalseIf true, only return tiles that don't have -1 for an index.
isCollidingbooleanYesfalseIf true, only return tiles that collide on at least one side.
hasInterestingFacebooleanYesfalseIf true, only return tiles that have at least one interesting face.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/FilteringOptions.js#L1
Since: 3.0.0


GIDData

<static> GIDData

nametypeoptionaldescription
gidnumberNoThe Tiled GID.
flippedHorizontalbooleanNoHorizontal flip flag.
flippedVerticalbooleanNoVertical flip flag.
flippedAntiDiagonalbooleanNoDiagonal flip flag.
rotationnumberNoAmount of rotation.
flippedbooleanNoIs flipped?

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/GIDData.js#L1
Since: 3.0.0


LayerDataConfig

<static> LayerDataConfig

nametypeoptionaldefaultdescription
namestringYesThe name of the layer, if specified in Tiled.
xnumberYes0The x offset of where to draw from the top left.
ynumberYes0The y offset of where to draw from the top left.
widthnumberYes0The width of the layer in tiles.
heightnumberYes0The height of the layer in tiles.
tileWidthnumberYes0The pixel width of the tiles.
tileHeightnumberYes0The pixel height of the tiles.
baseTileWidthnumberYes0The base tile width.
baseTileHeightnumberYes0The base tile height.
widthInPixelsnumberYes0The width in pixels of the entire layer.
heightInPixelsnumberYes0The height in pixels of the entire layer.
alphanumberYes1The alpha value of the layer.
visiblebooleanYestrueIs the layer visible or not?
propertiesArray.<object>YesLayer specific properties (can be specified in Tiled)
indexesarrayYesTile ID index map.
collideIndexesarrayYesTile Collision ID index map.
callbacksarrayYesAn array of callbacks.
bodiesarrayYesAn array of physics bodies.
dataarrayYesAn array of the tile data indexes.
tilemapLayerPhaser.Tilemaps.TilemapLayerYesA reference to the Tilemap layer that owns this data.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/LayerDataConfig.js#L1
Since: 3.0.0


MapDataConfig

<static> MapDataConfig

nametypeoptionaldefaultdescription
namestringYesThe key in the Phaser cache that corresponds to the loaded tilemap data.
widthnumberYes0The width of the entire tilemap.
heightnumberYes0The height of the entire tilemap.
tileWidthnumberYes0The width of the tiles.
tileHeightnumberYes0The height of the tiles.
widthInPixelsnumberYesThe width in pixels of the entire tilemap.
heightInPixelsnumberYesThe height in pixels of the entire tilemap.
formatnumberYesThe format of the Tilemap, as defined in Tiled.
orientationstring | Phaser.Tilemaps.OrientationYesThe orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.
renderOrderstringYesDetermines the draw order of tilemap. Default is right-down.
versionnumberYesThe version of Tiled the map uses.
propertiesnumberYesMap specific properties (can be specified in Tiled).
layersArray.<Phaser.Tilemaps.LayerData>YesThe layers of the tilemap.
imagesarrayYesAn array with all the layers configured to the MapData.
objectsobjectYesAn array of Tiled Image Layers.
collisionobjectYesAn object of Tiled Object Layers.
tilesetsArray.<Phaser.Tilemaps.Tileset>YesThe tilesets the map uses.
imageCollectionsarrayYesThe collection of images the map uses(specified in Tiled).
tilesarrayYesArray of Tile instances.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/MapDataConfig.js#L1
Since: 3.0.0


ObjectLayerConfig

<static> ObjectLayerConfig

nametypeoptionaldefaultdescription
namestringYes"'object layer'"The name of the Object Layer.
opacitynumberYes1The opacity of the layer, between 0 and 1.
propertiesanyYesThe custom properties defined on the Object Layer, keyed by their name.
propertytypesanyYesThe type of each custom property defined on the Object Layer, keyed by its name.
typestringYes"'objectgroup'"The type of the layer, which should be objectgroup.
visiblebooleanYestrueWhether the layer is shown (true) or hidden (false).
objectsArray.<any>YesAn array of all objects on this Object Layer.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/ObjectLayerConfig.js#L1
Since: 3.0.0


StyleConfig

<static> StyleConfig

nametypeoptionaldefaultdescription
tileColorPhaser.Display.Color | numbernullYes"blue"
collidingTileColorPhaser.Display.Color | numbernullYes"orange"
faceColorPhaser.Display.Color | numbernullYes"grey"

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/StyleConfig.js#L1
Since: 3.0.0


TiledObject

<static> TiledObject

nametypeoptionaldescription
idnumberNoThe unique object ID.
namestringNoThe name this object was assigned in Tiled.
typestringNoThe string type of this instance, as assigned in Tiled. Tiled supports inheriting instance types from tilesets; in that case, the type will be set in the tile's data, but will be '' here; use the gid to fetch the tile data or properties.
visiblebooleanYesThe visible state of this object.
xnumberYesThe horizontal position of this object, in pixels, relative to the tilemap.
ynumberYesThe vertical position of this object, in pixels, relative to the tilemap.
widthnumberYesThe width of this object, in pixels.
heightnumberYesThe height of this object, in pixels.
rotationnumberYesThe rotation of the object in clockwise degrees.
propertiesanyYesCustom properties object.
gidnumberYesOnly set if of type 'tile'.
flippedHorizontalbooleanYesOnly set if a tile object. The horizontal flip value.
flippedVerticalbooleanYesOnly set if a tile object. The vertical flip value.
flippedAntiDiagonalbooleanYesOnly set if a tile object. The diagonal flip value.
polylineArray.<Phaser.Types.Math.Vector2Like>YesOnly set if a polyline object. An array of objects corresponding to points, where each point has an x property and a y property.
polygonArray.<Phaser.Types.Math.Vector2Like>YesOnly set if a polygon object. An array of objects corresponding to points, where each point has an x property and a y property.
textanyYesOnly set if a text object. Contains the text objects properties.
rectanglebooleanYesOnly set, and set to true, if a rectangle object.
ellipsebooleanYesOnly set, and set to true, if a ellipse object.
pointbooleanYesOnly set, and set to true, if a point object.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/TiledObject.js#L1
Since: 3.0.0


TilemapConfig

<static> TilemapConfig

nametypeoptionaldefaultdescription
keystringYesThe key in the Phaser cache that corresponds to the loaded tilemap data.
dataArray.<Array.<number>>YesInstead of loading from the cache, you can also load directly from a 2D array of tile indexes.
tileWidthnumberYes32The width of a tile in pixels.
tileHeightnumberYes32The height of a tile in pixels.
widthnumberYes10The width of the map in tiles.
heightnumberYes10The height of the map in tiles.
insertNullbooleanYesfalseControls how empty tiles, tiles with an index of -1, in the map data are handled. If true, empty locations will get a value of null. If false, empty location will get a Tile object with an index of -1. If you've a large sparsely populated map and the tile data doesn't need to change then setting this value to true will help with memory consumption. However if your map is small or you need to update the tiles dynamically, then leave the default value set.

Type: object

Member of: Phaser.Types.Tilemaps

Source: src/tilemaps/typedefs/TilemapConfig.js#L1
Since: 3.0.0