Tilemap Class

The tilemap which displays 2D tile-based game map.

Constructor

Tilemap ()

Item Index

Methods Properties

Methods

addChild ( child ) Object

Adds a child to the container.

Parameters:

  • child Object

    The child to add

Returns:

Object:
The child that was added

addChildAt ( child  index ) Object

Adds a child to the container at a specified index.

Parameters:

  • child Object

    The child to add

  • index Number

    The index to place the child in

Returns:

Object:
The child that was added

isReady () Boolean

Checks whether the tileset is ready to render.

Returns:

Boolean:
True if the tilemap is ready

refresh ()

Forces to repaint the entire tilemap.

removeChild ( child ) Object

Removes a child from the container.

Parameters:

  • child Object

    The child to remove

Returns:

Object:
The child that was removed

removeChildAt ( index ) Object

Removes a child from the specified index position.

Parameters:

  • index Number

    The index to get the child from

Returns:

Object:
The child that was removed

setData ( width  height  data )

Sets the tilemap data.

Parameters:

  • width Number

    The width of the map in number of tiles

  • height Number

    The height of the map in number of tiles

  • data Array

    The one dimensional array for the map data

update ()

Updates the tilemap for each frame.

Properties

animationCount Number

The animation count for autotiles.

bitmaps Array

The bitmaps used as a tileset.

children Array

[read-only] The array of children of the sprite.

flags Array

The tileset flags.

height Number

The height of the screen in pixels.

horizontalWrap Boolean

Whether the tilemap loops horizontal.

origin Point

The origin point of the tilemap for scrolling.

parent Object

[read-only] The object that contains the tilemap.

tileHeight Number

The height of a tile in pixels.

tileWidth Number

The width of a tile in pixels.

verticalWrap Boolean

Whether the tilemap loops vertical.

width Number

The width of the screen in pixels.