Moai SDK
1.5 revision 1 (MoaiEdition)
|
Returns the coordinate of a cell given an address.
function cellAddrToCoord ( MOAIGridSpace self, number cellAddr )
self | ( MOAIGridSpace ) |
cellAddr | ( number ) |
Returns the address of a cell given a coordinate (in tiles).
function getCellAddr ( MOAIGridSpace self, number xTile, number yTile )
self | ( MOAIGridSpace ) |
xTile | ( number ) |
yTile | ( number ) |
Returns the dimensions of a single grid cell.
function getCellSize ( MOAIGridSpace self )
self | ( MOAIGridSpace ) |
Returns the offset of tiles from cells.
function getOffset ( MOAIGridSpace self )
self | ( MOAIGridSpace ) |
Returns the dimensions of the grid (in tiles).
function getSize ( MOAIGridSpace self )
self | ( MOAIGridSpace ) |
Returns the grid space coordinate of the tile. The optional 'position' flag determines the location of the coordinate within the tile.
function getTileLoc ( MOAIGridSpace self, number xTile, number yTile [, number position ] )
self | ( MOAIGridSpace ) |
xTile | ( number ) |
yTile | ( number ) |
position | ( number ) Optional. See MOAIGridSpace for list of positions. Default it MOAIGridSpace.TILE_CENTER. |
Returns the dimensions of a single grid tile.
function getTileSize ( MOAIGridSpace self )
self | ( MOAIGridSpace ) |
Initialize a grid with hexagonal tiles.
function initDiamondGrid ( MOAIGridSpace self, number width, number height [, number tileWidth, number tileHeight, number xGutter, number yGutter ] )
self | ( MOAIGridSpace ) |
width | ( number ) |
height | ( number ) |
tileWidth | ( number ) Optional. Default value is 1. |
tileHeight | ( number ) Optional. Default value is 1. |
xGutter | ( number ) Optional. Default value is 0. |
yGutter | ( number ) Optional. Default value is 0. |
Initialize a grid with hexagonal tiles.
function initHexGrid ( MOAIGridSpace self, number width, number height [, number radius, number xGutter, number yGutter ] )
self | ( MOAIGridSpace ) |
width | ( number ) |
height | ( number ) |
radius | ( number ) Optional. Default value is 1. |
xGutter | ( number ) Optional. Default value is 0. |
yGutter | ( number ) Optional. Default value is 0. |
Initialize a grid with oblique tiles.
function initObliqueGrid ( MOAIGridSpace self, number width, number height [, number tileWidth, number tileHeight, number xGutter, number yGutter ] )
self | ( MOAIGridSpace ) |
width | ( number ) |
height | ( number ) |
tileWidth | ( number ) Optional. Default value is 1. |
tileHeight | ( number ) Optional. Default value is 1. |
xGutter | ( number ) Optional. Default value is 0. |
yGutter | ( number ) Optional. Default value is 0. |
Initialize a grid with rectangular tiles.
function initRectGrid ( MOAIGridSpace self, number width, number height [, number tileWidth, number tileHeight, number xGutter, number yGutter ] )
self | ( MOAIGridSpace ) |
width | ( number ) |
height | ( number ) |
tileWidth | ( number ) Optional. Default value is 1. |
tileHeight | ( number ) Optional. Default value is 1. |
xGutter | ( number ) Optional. Default value is 0. |
yGutter | ( number ) Optional. Default value is 0. |
Returns the address of a cell given a a coordinate in grid space.
function locToCellAddr ( MOAIGridSpace self, number x, number y )
self | ( MOAIGridSpace ) |
x | ( number ) |
y | ( number ) |
Transforms a coordinate in grid space into a tile index.
function locToCoord ( MOAIGridSpace self, number x, number y )
self | ( MOAIGridSpace ) |
x | ( number ) |
y | ( number ) |
Repeats a grid indexer along X or Y. Only used when a grid is attached.
function setRepeat ( MOAIGridSpace self [, boolean repeatX, boolean repeatY ] )
self | ( MOAIGridSpace ) |
repeatX | ( boolean ) Optional. Default value is true. |
repeatY | ( boolean ) Optional. Default value is repeatX. |
Set the shape of the grid tiles.
function setShape ( MOAIGridSpace self [, number shape ] )
self | ( MOAIGridSpace ) |
shape | ( number ) Optional. One of MOAIGridSpace.RECT_SHAPE, MOAIGridSpace.DIAMOND_SHAPE, MOAIGridSpace.OBLIQUE_SHAPE, MOAIGridSpace.HEX_SHAPE. Default value is MOAIGridSpace.RECT_SHAPE. |
Initializes dimensions of grid and reserves storage for tiles.
function setSize ( MOAIGridSpace self, number width, number height [, number cellWidth, number cellHeight, number xOff, number yOff, number tileWidth, number tileHeight ] )
self | ( MOAIGridSpace ) |
width | ( number ) |
height | ( number ) |
cellWidth | ( number ) Optional. Default value is 1. |
cellHeight | ( number ) Optional. Default value is 1. |
xOff | ( number ) Optional. X offset of the tile from the cell. |
yOff | ( number ) Optional. Y offset of the tile from the cell. |
tileWidth | ( number ) Optional. Default value is cellWidth. |
tileHeight | ( number ) Optional. Default value is cellHeight. |
Reimplemented in MOAITileDeck2D.
Wraps a tile index to the range of the grid.
function wrapCoord ( MOAIGridSpace self, number xTile, number yTile )
self | ( MOAIGridSpace ) |
xTile | ( number ) |
yTile | ( number ) |