AngelScript
|
Path: /sdk/add_on/scriptgrid/
The grid
type is a template object that allow the scripts to declare 2D grids of any type. In many ways it is similar to the array template object, but it is specialized for use with areas.
The type is registered with RegisterScriptGrid(asIScriptEngine *engine)
.
class grid<T> { grid(uint width, uint height); grid(uint width, uint height, const T &in fillValue);
uint width() const; uint height() const;
T &opIndex(uint, uint); const T &opIndex(uint, uint) const; }
// Initialize a 5x5 map grid<int> map = {{1,0,1,1,1}, {0,0,1,0,0}, {0,1,1,0,1}, {0,1,1,0,1}, {0,0,0,0,1}};
// A function to verify if the next area is walkable bool canWalk(uint x, uint y) { // If the map in the destination is // clear, it is possible to wark there return map[x,y] == 0; }