new CollisionMap(tilesize, data)
Parameters:
| Name | Type | Description |
|---|---|---|
tilesize |
Number | Tile size in pixel |
data |
Array | A 2D array representing the map. |
- Source:
Members
-
data :Array
-
Map data as a 2D array
Type:
- Array
- Source:
-
<readonly> height
-
Height of this map, in tile
- Source:
-
tilesize :Number
-
Size of tiles in pixel
Type:
- Source:
-
<readonly> width
-
Width of this map, in tile
- Source:
Methods
-
getTile(r, q)
-
Get the tile index with its row and column number
Parameters:
Name Type Description rNumber Row of this tile
qNumber Column of this tile
- Source:
Returns:
Tile index
- Type
- Number
-
getTileAt(x, y)
-
Get the tile index at a specific position(in pixel)
Parameters:
Name Type Description xNumber X position
yNumber Y position
- Source:
Returns:
Tile index
- Type
- Number
-
setTile(r, q, tile)
-
Set the tile at the giving row and column
Parameters:
Name Type Description rNumber Row of this tile
qNumber Column of this tile
tileNumber New tile index
- Source:
-
setTileAt(x, y, tile)
-
Set the tile at a specific position
Parameters:
Name Type Description xNumber X position
yNumber Y position
tileNumber New tile index
- Source:
-
trace(coll, sx, sy, res)
-
Trace a collider against this map.
Parameters:
Name Type Description collCollider Collider object.
sxNumber Movement on x-axis.
syNumber Movement on y-axis.
resObject Resolved movement result.
- Source: