Constructor
new TileCollisionLayer(position, size, tileInfoopt, renderOrderopt)
Create a tile layer object
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
position | Vector2 | World space position | ||
size | Vector2 | World space size | ||
tileInfo | TileInfo | <optional> | Tile info for layer | |
renderOrder | number | <optional> | 0 | Objects are sorted by renderOrder |
- Source
Extends
- TileLayer
Members
collisionData
PropertiesType | Description |
---|---|
Array.<number> | The tile collision grid |
- Source
Methods
collisionRaycast(posStart, posEnd, objectopt, normalopt) → {Vector2|undefined}
Return the exact position of the boudnary of first tile hit, undefined if nothing was hit.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
posStart | Vector2 | ||
posEnd | Vector2 | ||
object | EngineObject | <optional> | An object or undefined for generic test |
normal | Vector2 | <optional> | Optional normal of the surface hit |
- Source
Returns:
- Type:
- Vector2 |
undefined
collisionTest(pos, sizeopt, objectopt) → {boolean}
Check if collision with another object should occur
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos | Vector2 | |||
size | Vector2 | <optional> | (0,0) | |
object | EngineObject | <optional> |
- Source
Returns:
- Type:
- boolean
destroy()
Destroy this tile layer
- Source
getCollisionData(gridPos) → {number}
Get tile collision data for a given cell in the grid
Parameters:
Name | Type | Description |
---|---|---|
gridPos | Vector2 |
- Source
Returns:
- Type:
- number
initCollision(size)
Clear and initialize tile collision to new size
Parameters:
Name | Type | Description |
---|---|---|
size | Vector2 | width and height of tile collision 2d grid |
- Source
setCollisionData(gridPos, dataopt)
Set tile collision data for a given cell in the grid
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
gridPos | Vector2 | |||
data | number | <optional> | 1 |
- Source