Namespace: Tilemaps

Phaser.Types. Tilemaps

Type Definitions


CreateFromObjectLayerConfig

Type:
  • object
Properties:
Name Type Argument Default Description
id number <optional>

A unique Object ID to convert.

gid number <optional>

An Object GID to convert.

name string <optional>

An Object Name to convert.

classType Phaser.GameObjects.GameObject <optional>
Phaser.GameObjects.Sprite

A custom class type to convert the objects in to.

scene Phaser.Scene <optional>

A Scene reference, passed to the Game Objects constructors.

container Phaser.GameObjects.Container <optional>

Optional Container to which the Game Objects are added.

key string | Phaser.Textures.Texture <optional>

Optional key of a Texture to be used, as stored in the Texture Manager, or a Texture instance.

frame string | number <optional>

Optional name or index of the frame within the Texture.

Since: 3.50.0
Source: src/tilemaps/typedefs/CreateFromObjectLayerConfig.js (Line 1)

DebugStyleOptions

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

styleConfig.collidingTileColor Phaser.Display.Color <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.

styleConfig.faceColor Phaser.Display.Color <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/DebugStyleOptions.js (Line 1)

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)

GIDData

Type:
  • object
Properties:
Name Type Description
gid number

The Tiled GID.

flippedHorizontal boolean

Horizontal flip flag.

flippedVertical boolean

Vertical flip flag.

flippedAntiDiagonal boolean

Diagonal flip flag.

rotation number

Amount of rotation.

flipped boolean

Is flipped?

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

LayerDataConfig

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

The name of the layer, if specified in Tiled.

x number <optional>
0

The x offset of where to draw from the top left.

y number <optional>
0

The y offset of where to draw from the top left.

width number <optional>
0

The width of the layer in tiles.

height number <optional>
0

The height of the layer in tiles.

tileWidth number <optional>
0

The pixel width of the tiles.

tileHeight number <optional>
0

The pixel height of the tiles.

baseTileWidth number <optional>
0

The base tile width.

baseTileHeight number <optional>
0

The base tile height.

widthInPixels number <optional>
0

The width in pixels of the entire layer.

heightInPixels number <optional>
0

The height in pixels of the entire layer.

alpha number <optional>
1

The alpha value of the layer.

visible boolean <optional>
true

Is the layer visible or not?

properties Array.<object> <optional>

Layer specific properties (can be specified in Tiled)

indexes array <optional>

Tile ID index map.

collideIndexes array <optional>

Tile Collision ID index map.

callbacks array <optional>

An array of callbacks.

bodies array <optional>

An array of physics bodies.

data array <optional>

An array of the tile data indexes.

tilemapLayer Phaser.Tilemaps.TilemapLayer <optional>

A reference to the Tilemap layer that owns this data.

Since: 3.0.0
Source: src/tilemaps/typedefs/LayerDataConfig.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 number <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>

Array of Tile instances.

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 number

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

point boolean <optional>

Only set, and set to true, if a point 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.<number>> <optional>

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

tileWidth number <optional>
32

The width of a tile in pixels.

tileHeight number <optional>
32

The height of a tile in pixels.

width number <optional>
10

The width of the map in tiles.

height number <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)