MCPcopy Create free account
hub / github.com/esengine/esengine / hasCollision

Method hasCollision

packages/tilemap/src/TilemapComponent.ts:833–841  ·  view source on GitHub ↗

* Check if tile has collision * 检查图块是否有碰撞 * @param col Column (X) | 列(X) * @param row Row (Y) | 行(Y) * @returns True if has collision | 如果有碰撞返回true

(col: number, row: number)

Source from the content-addressed store, hash-verified

831 * @returns True if has collision | 如果有碰撞返回true
832 */
833 hasCollision(col: number, row: number): boolean {
834 if (col < 0 || col >= this._width || row < 0 || row >= this._height) {
835 return true;
836 }
837 if (this._collisionData.length === 0) {
838 return false;
839 }
840 return this._collisionData[row * this._width + col] > 0;
841 }
842
843 /**
844 * Get collision type at tile position

Callers 4

hasCollisionAtMethod · 0.95
getPreviewTilesMethod · 0.80
floodFillMethod · 0.80
TilemapCanvasFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected