-
Notifications
You must be signed in to change notification settings - Fork 562
Structure of the Board Object
gjtrowbridge edited this page Oct 7, 2014
·
8 revisions
Here are the main important properties of the Board object.
{
tiles: [ /* 2-dimensional array of all tiles...more below */],
lengthOfSide: /* The length of each side of the board */
}
The tiles
property contains a two-dimensional array with length and width equal to the lengthOfSide
property. Access a tile with the following code:
var distanceFromTop = 3;
var distanceFromLeft = 0;
var objectOnThisTile = board.tiles[distanceFromTop][distanceFromLeft];
and objectOnThisTile
will be whatever type of object is on that tile.
For example, if there is a hero standing on the square 3 spaces from the top and 0 spaces from the left of the board), then objectOnThisTile.type
will equal Hero
.
And here's the...