Quad
Introduction¶
Quad grid object of Board system.
- Author: Rex
- Grid object of board
Usage¶
Create instance¶
var grid = scene.rexBoard.add.quadGrid({
x: 0,
y: 0,
cellWidth: 0,
cellHeight: 0,
type: 0,
// dir: 4
});
x
,y
: World position of tile (0, 0)cellWidth
: The width of the cell, in pixels.cellHeight
: The height of the cell, in pixels.type
0
, ororthogonal
1
, orisometric
dir
:4
or'4dir'
: Left/Down/Right/Up8
or'8dir'
: Left/Down/Right/Up/Left-down/Down-right/Right-up/Up-left
Set world position of tile (0, 0)¶
grid.setOriginPosition(worldX, worldY);
Set cell size¶
grid.setCellSize(cellWidth, cellHeight);
Set grid type¶
grid.setType(type);
type
0
, ororthogonal
1
, orisometric
Get world position¶
var worldXY = grid.getWorldXY(tileX, tileY); // worldXY: {x, y}
// var out = grid.getWorldXY(tileX, tileY, out);
Get tile position¶
var tileXY = grid.getWorldXY(tileX, tileY); // tileXY: {x, y}
// var out = grid.getWorldXY(tileX, tileY, out);
Directions¶
0
: Left1
: Down2
: Right3
: Up4
: Left-down5
: Down-right6
: Right-up7
: Up-left