Skip to content
fahimc edited this page Mar 22, 2013 · 3 revisions

container(id): set the containing DOM element. If not set 'document.body' is the container.
showGrid(value): set true if you wish to see the grid.
init(): Initialise the Engine.
addToBackgroundLayer(obj): Add a Class (extension of UIElement) or a DOM object to the background layer.
addToCharacterLayer(obj): Add a Class (extension of UIElement) or a DOM object to the character layer.
addToFrontLayer(obj): Add a Class (extension of UIElement) or a DOM object to the front layer.
removeFromBackgroundLayer(obj): Remove a Class (extension of UIElement) or a DOM object from the background layer.
removeFromCharacterLayer(obj): Remove a Class (extension of UIElement) or a DOM object from the character layer.
removeFromFrontLayer(obj): Remove a Class (extension of UIElement) or a DOM object from the front layer.
ignoreBlocks(obj/x,y): Add a Class (extension of UIElement) and it will calculate the number of blocks to ignore or provide the x and y and the blocks containing those co-ordinates will be ignored.
addObstacle(obj/x,y): Add a Class (extension of UIElement) and it will calculate the number of blocks for the obstacle or provide the x and y and the blocks containing those co-ordinates will become obstacles. This does not add the object to the game, you need to add the graphic to a layer.
getOccupiedXY(x,y):Boolean: returns if the co-ordinates provided is occupied.
findPathTo(obj, x, y):Array: returns an Array of the path (x,y) if the co-ordinates provided is reachable.
getXCell(x):Number: returns the cell index of the x value provided.
getYCell(y):Number: returns the cell index of the y value provided.
width(value):Number: sets or gets the width of the whole grid in pixels.
height(value):Number: sets or gets the height of the whole grid in pixels.

Clone this wiki locally