|
Isometric Computation Tools
The Isometric Computation Tools package is an extension for Stencyl development environment. It provides mathematical tools for conversion between screen and environment coordinate systems in isometric projections.
Basic Vocabulary
In the environment, width refers to the dimension along the x axis, height as the dimension along the y axis, and depth as the dimension along the z axis.
The extension refers to the coordinates in the environment as grid coordinates.
The environment can be divided into tiles. Tiles must be square width and height, but may have a different depth. The default is a tile size of 32 pixels, and depth of 16 pixels.
The total depth of the environment is divided into levels, at divisions set by the tile depth level height, much like width and height are divided into columns and rows.
Initialization
At the start of a new scene the coordinate system needs to be initialized. The first four code blocks (setStartX, setStartY, setLevelHeight, and setTileSize) can be used to set the scene coordinate of the grid origin, sizes of tiles, etc. The next four blocks (getStartX, getStartY, getLevelHeight, and getTileSize) can be used to read the parameter settings.
Function Reference
Note: All arguments are integers unless otherwise noted.
Function | Arguments | Description |
setStartX | x | Set the scene x coordinate of the grid origin
|
setStartY | y | Set the scene y coordinate of the grid origin
|
setLevelHeight | v | Set the depth of a tile in grid coordinates
|
setTileSize | v | Set the width and height of a tile in grid coordinates
|
|
getStartX | | Returns the scene x coordinate of the grid origin
|
getStartY | | Returns the scene y coordinate of the grid origin
|
getLevelHeight | | Returns the depth of a tile in grid coordinates
|
getTileSize | | Returns the width and height a tile in grid coordinates
|
|
xSceneAtRC | row, col | Returns the scene x coordinate at grid row, col
|
ySceneAtRC | row, col, l | Returns the scene y coordinate at grid row, col, and level l
|
|
xSceneAtGridXY | x, y | Returns the scene x coordinate at grid x, y
|
ySceneAtGridXY | x, y, l | Returns the scene x coordinate at grid x, y, and level l
|
ySceneAtGridXYZ | x, y, z | Returns the scene x coordinate at grid x, y, z
|
|
rowAtSceneXY | x, y, l | Returns the row, in grid coordinates, at scene x, y, and level l
|
columnAtSceneXY | x, y | Returns the row, in grid coordinates, at scene x, y
|
|
rowAtGridY | y | Returns the row, in grid coordinates, at grid y
|
columnAtGridX | y | Returns the column, in grid coordinates, at grid x
|
levelAtGridZ | y | Returns the level, in grid coordinates, at grid z
|
|
xGridAtSceneXY | x, y | Returns grid x coordinate corresponding to scene coordinate x, y
|
yGridAtSceneXY | x, y, l | Returns grid y coordinate corresponding to scene coordinate x, y, and level l
|
yGridAtSceneXYZ | x, y | Returns grid y coordinate corresponding to scene coordinate x, y, and grid coordinate z
|
|
|