Tilemap Class
The tilemap which displays 2D tile-based game map.
Constructor
Tilemap ()
Item Index
Methods PropertiesMethods
addChild ( child ) Object
Adds a child to the container.
Parameters:
-
child
ObjectThe 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
ObjectThe child to add
-
index
NumberThe 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
ObjectThe child to remove
Returns:
Object:
The child that was removed
removeChildAt ( index ) Object
Removes a child from the specified index position.
Parameters:
-
index
NumberThe index to get the child from
Returns:
Object:
The child that was removed
setData ( width height data )
Sets the tilemap data.
Parameters:
-
width
NumberThe width of the map in number of tiles
-
height
NumberThe height of the map in number of tiles
-
data
ArrayThe 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.