Constructor
new TileCollisionLayer(pos, size, tileInfoopt, renderOrderopt, useWebGLopt)
Create a tile layer object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
pos | 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 |
useWebGL | boolean | <optional> | true | Should this layer use WebGL for rendering |
- Source
Extends
- TileLayer
Members
collisionData
Properties| Type | Description |
|---|---|
| Array.<number> | The tile collision grid |
- Source
Methods
clearCollisionData(layerPos)
Clear tile collision data for a given cell in the layer
| Name | Type | Description |
|---|---|---|
layerPos | Vector2 |
- Source
collisionRaycast(posStart, posEnd, objectopt, normalopt) → {Vector2|undefined}
Return the exact position of the boundary of first tile hit, undefined if nothing was hit. The point will be inside the colliding tile if it hits (may have a tiny shift)
| 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
- Type:
- Vector2 |
undefined
collisionTest(pos, sizeopt, objectopt) → {boolean}
Check if collision with another object should occur
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
pos | Vector2 | |||
size | Vector2 | <optional> | vec2() | |
object | EngineObject | <optional> |
- Source
- Type:
- boolean
destroy()
Destroy this tile layer
- Source
getCollisionData(layerPos) → {number}
Get tile collision data for a given cell in the layer
| Name | Type | Description |
|---|---|---|
layerPos | Vector2 |
- Source
- Type:
- number
initCollision(size)
Clear and initialize tile collision to new size
| Name | Type | Description |
|---|---|---|
size | Vector2 | width and height of tile collision 2d grid |
- Source
setCollisionData(layerPos, dataopt)
Set tile collision data for a given cell in the layer
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
layerPos | Vector2 | |||
data | number | <optional> | 1 |
- Source