Constructors

Fields Summary

Functions Summary

wade.tilemap.checkCollisionsAtTile (x, y, excludeObject)

Check to see if there are any objects with collision in a specific tile
wade.tilemap.drawGrid (toggle)

Draw a grid on the tilemap terrain. Very useful during development and for debugging.
wade.tilemap.exportMap (stringify)

Export the current map and its state to a JSON object that can be passed into the map parameter of wade.tilemap.init()
wade.tilemap.getDetailData (tileX, tileY)

Get the data associated with a specific terrain detail
wade.tilemap.getDetailSprite (tileX, tileY)

Get the sprite being used as a terrain detail at the specified tile coordinates
wade.tilemap.getNumTiles ()

Get the number of terrain tiles being used
wade.tilemap.getTerrain ()

Get the tilemap terrain object
wade.tilemap.getTerrainLayerId ()

Get the layer Id that is being used by terrain sprites
wade.tilemap.getTileCoordinates (worldX, worldY)

Get the tile coordinates (indices) corresponding to the spefified world-space positions
wade.tilemap.getTileData (tileX, tileY)

Get the data associated with a specific tile
wade.tilemap.getTileScaleFactor ()

Get the scale factor that is being applied to each terrain tile (often to compensate for floating-point errors).
wade.tilemap.getTileSize ()

Set collision information for a tile, specifying which object occupies the tile
wade.tilemap.getTileSprite (tileX, tileY)

Get the sprite being used as a terrain tile at the specified tile coordinates
wade.tilemap.getTransitionData (tileX, tileY)

Get the data associated with a specific terrain transition
wade.tilemap.getTransitionSprite (tileX, tileY)

Get the sprite being used as a terrain transition at the specified tile coordinates
wade.tilemap.getWorldCoordinates (tileX, tileY)

Get the coordinates, in world space, corresponding to an isometric tile
wade.tilemap.importScene (data, callback)

Import tilemap terrain from a data object
wade.tilemap.reset ()

Restore the map
wade.tilemap.setNumTiles (x, y)

Set the current number of tiles

Fields Details

Function Details

wade.tilemap.checkCollisionsAtTile (x, y, excludeObject)

Check to see if there are any objects with collision in a specific tile

number x : The tilemap X coordinate of the tile


number y : The tilemap Y coordinate of the tile


sceneObject excludeObject : An option object to ignore, mostly for collisions with self


Returns boolean : Whether there are any objects with collision in the tile

^
wade.tilemap.drawGrid (toggle)

Draw a grid on the tilemap terrain. Very useful during development and for debugging.

boolean toggle (optional): Whether to draw the grid or not. If omitted, it's assumed to be true.

^
wade.tilemap.exportMap (stringify)

Export the current map and its state to a JSON object that can be passed into the map parameter of wade.tilemap.init()

boolean stringify (optional): Whether to serialize the resulting JSON object to a string


Returns object|string : The JSON object (or JSON string) representing the current map

^
wade.tilemap.getDetailData (tileX, tileY)

Get the data associated with a specific terrain detail

number tileX : The index of the tile on the tilemap X axis


number tileY : The index of the tile on the tilemap Y axis


Returns Object : An object containing any data associated with a specific terrain detail ( such as which image file it's using, if it has animations, and any other data set with setDetail() ).

^
wade.tilemap.getDetailSprite (tileX, tileY)

Get the sprite being used as a terrain detail at the specified tile coordinates

number tileX : The index of the tile on the tilemap X axis


number tileY : The index of the tile on the tilemap Y axis


Returns Sprite : The sprite at the current tile coordinates

^
wade.tilemap.getNumTiles ()

Get the number of terrain tiles being used

Returns {x: number, y: number} : The current number of tiles

^
wade.tilemap.getTerrain ()

Get the tilemap terrain object

Returns SceneObject : The isometric terrain object

^
wade.tilemap.getTerrainLayerId ()

Get the layer Id that is being used by terrain sprites

Returns number : The id of the layer used by terrain sprites

^
wade.tilemap.getTileCoordinates (worldX, worldY)

Get the tile coordinates (indices) corresponding to the spefified world-space positions

number|object worldX : The X coordinate of the world-space position. Alternatively you can use an object with x and y fields, and omit the second parameter.


number worldY (optional): The Y coordinate of the world-space position


Returns {x: number, y: number, valid: boolean} : An object with the tile x and y indices. There is also a valid flag indicating whether the tile is inside the current terrain boundaries.

^
wade.tilemap.getTileData (tileX, tileY)

Get the data associated with a specific tile

number tileX : The index of the tile on the tilemap X axis


number tileY : The index of the tile on the tilemap Y axis


Returns Object : An object containing any data associated with a specific tile ( such as which image file it's using, if it has animations, and any other data set with setTile() ).

^
wade.tilemap.getTileScaleFactor ()

Get the scale factor that is being applied to each terrain tile (often to compensate for floating-point errors).

Returns number : The scale factor

^
wade.tilemap.getTileSize ()

Set collision information for a tile, specifying which object occupies the tile

number x : The isometric X coordinate of the tile


number y : The isometric Y coordinate of the tile


Object tilemapObject (optional): The isometric object that occupies the tile


this.setCollisionAtTile = function(x, y, isoObject)
{
if (!this.collisionMap[x])
{
this.collisionMap[x] = [];
}
this.collisionMap[x][y] = isoObject;
};*/

/**
Get the size (in world units) of a terrain tile

Returns {x: number, y: number} : An object representing the size of a terrain tile

^
wade.tilemap.getTileSprite (tileX, tileY)

Get the sprite being used as a terrain tile at the specified tile coordinates

number tileX : The index of the tile on the tilemap X axis


number tileY : The index of the tile on the tilemap Y axis


Returns Sprite : The sprite at the current tile coordinates

^
wade.tilemap.getTransitionData (tileX, tileY)

Get the data associated with a specific terrain transition

number tileX : The index of the tile on the tilemap X axis


number tileY : The index of the tile on the tilemap Y axis


Returns Object : An object containing any data associated with a specific terrain transition ( such as which image file it's using, if it has animations, and any other data set with setTransition() ).

^
wade.tilemap.getTransitionSprite (tileX, tileY)

Get the sprite being used as a terrain transition at the specified tile coordinates

number tileX : The index of the tile on the tilemap X axis


number tileY : The index of the tile on the tilemap Y axis


Returns Sprite : The sprite at the current tile coordinates

^
wade.tilemap.getWorldCoordinates (tileX, tileY)

Get the coordinates, in world space, corresponding to an isometric tile

number|object tileX : The tile index on the isometric X axis. Alternatively you can use an object with x and y fields, and omit the second parameter.


number tileY (optional): The tile index on the isometric Y axis


Returns {x: number, y: number} : An object representing the world space position corresponding to the tile.

^
wade.tilemap.importScene (data, callback)

Import tilemap terrain from a data object

Object data : The tilemap scene data object


function callback (optional): A function to call when the assets referenced in the data have been fully loaded and added to the scene

^
wade.tilemap.reset ()

Restore the map
^
wade.tilemap.setNumTiles (x, y)

Set the current number of tiles

number x : How many tiles on the tilemap X axis


number y : How many tiles on the tilemap Y axis

^