Namespace: Tilemaps

Phaser.Types. Tilemaps

Type Definitions


FilteringOptions

Type:
  • object
Properties:
Name Type Argument Default Description
isNotEmpty boolean <optional>
false

If true, only return tiles that don't have -1 for an index.

isColliding boolean <optional>
false

If true, only return tiles that collide on at least one side.

hasInterestingFace boolean <optional>
false

If true, only return tiles that have at least one interesting face.

Since: 3.0.0
Source: src/tilemaps/typedefs/FilteringOptions.js (Line 1)

GetTilesWithinFilteringOptions

Type:
  • object
Properties:
Name Type Argument Default Description
isNotEmpty boolean <optional>
false

If true, only return tiles that don't have -1 for an index.

isColliding boolean <optional>
false

If true, only return tiles that collide on at least one side.

hasInterestingFace boolean <optional>
false

If true, only return tiles that have at least one interesting face.

Since: 3.0.0
Source: src/tilemaps/typedefs/GetTilesWithinFilteringOptions.js (Line 1)

MapDataConfig

Type:
  • object
Properties:
Name Type Argument Default Description
name string <optional>

The key in the Phaser cache that corresponds to the loaded tilemap data.

width number <optional>
0

The width of the entire tilemap.

height number <optional>
0

The height of the entire tilemap.

tileWidth number <optional>
0

The width of the tiles.

tileHeight number <optional>
0

The height of the tiles.

widthInPixels number <optional>

The width in pixels of the entire tilemap.

heightInPixels number <optional>

The height in pixels of the entire tilemap.

format integer <optional>

The format of the Tilemap, as defined in Tiled.

orientation string <optional>

The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.

renderOrder string <optional>

Determines the draw order of tilemap. Default is right-down.

version number <optional>

The version of Tiled the map uses.

properties number <optional>

Map specific properties (can be specified in Tiled).

layers Array.<Phaser.Tilemaps.LayerData> <optional>

The layers of the tilemap.

images array <optional>

An array with all the layers configured to the MapData.

objects object <optional>

An array of Tiled Image Layers.

collision object <optional>

An object of Tiled Object Layers.

tilesets Array.<Phaser.Tilemaps.Tileset> <optional>

The tilesets the map uses.

imageCollections array <optional>

The collection of images the map uses(specified in Tiled).

tiles array <optional>

[description]

Since: 3.0.0
Source: src/tilemaps/typedefs/MapDataConfig.js (Line 1)

ObjectLayerConfig

Type:
  • object
Properties:
Name Type Argument Default Description
name string <optional>
'object layer'

The name of the Object Layer.

opacity number <optional>
1

The opacity of the layer, between 0 and 1.

properties any <optional>

The custom properties defined on the Object Layer, keyed by their name.

propertytypes any <optional>

The type of each custom property defined on the Object Layer, keyed by its name.

type string <optional>
'objectgroup'

The type of the layer, which should be objectgroup.

visible boolean <optional>
true

Whether the layer is shown (true) or hidden (false).

objects Array.<any> <optional>

An array of all objects on this Object Layer.

Since: 3.0.0
Source: src/tilemaps/typedefs/ObjectLayerConfig.js (Line 1)

StyleConfig

Type:
  • object
Properties:
Name Type Argument Default Description
tileColor Phaser.Display.Color | number | null <optional>
<nullable>
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.

collidingTileColor Phaser.Display.Color | number | null <optional>
<nullable>
orange

Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn.

faceColor Phaser.Display.Color | number | null <optional>
<nullable>
grey

Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn.

Since: 3.0.0
Source: src/tilemaps/typedefs/StyleConfig.js (Line 1)

TiledObject

Type:
  • object
Properties:
Name Type Argument Description
id integer

The unique object ID.

name string

The name this object was assigned in Tiled.

type string

The type, as assigned in Tiled.

visible boolean <optional>

The visible state of this object.

x number <optional>

The horizontal position of this object, in pixels, relative to the tilemap.

y number <optional>

The vertical position of this object, in pixels, relative to the tilemap.

width number <optional>

The width of this object, in pixels.

height number <optional>

The height of this object, in pixels.

rotation number <optional>

The rotation of the object in clockwise degrees.

properties any <optional>

Custom properties object.

gid integer <optional>

Only set if of type 'tile'.

flippedHorizontal boolean <optional>

Only set if a tile object. The horizontal flip value.

flippedVertical boolean <optional>

Only set if a tile object. The vertical flip value.

flippedAntiDiagonal boolean <optional>

Only set if a tile object. The diagonal flip value.

polyline Array.<Phaser.Types.Math.Vector2Like> <optional>

Only set if a polyline object. An array of objects corresponding to points, where each point has an x property and a y property.

polygon Array.<Phaser.Types.Math.Vector2Like> <optional>

Only set if a polygon object. An array of objects corresponding to points, where each point has an x property and a y property.

text any <optional>

Only set if a text object. Contains the text objects properties.

rectangle boolean <optional>

Only set, and set to true, if a rectangle object.

ellipse boolean <optional>

Only set, and set to true, if a ellipse object.

Since: 3.0.0
Source: src/tilemaps/typedefs/TiledObject.js (Line 1)

TilemapConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string <optional>

The key in the Phaser cache that corresponds to the loaded tilemap data.

data Array.<Array.<integer>> <optional>

Instead of loading from the cache, you can also load directly from a 2D array of tile indexes.

tileWidth integer <optional>
32

The width of a tile in pixels.

tileHeight integer <optional>
32

The height of a tile in pixels.

width integer <optional>
10

The width of the map in tiles.

height integer <optional>
10

The height of the map in tiles.

insertNull boolean <optional>
false

Controls 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.

Since: 3.0.0
Source: src/tilemaps/typedefs/TilemapConfig.js (Line 1)