Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updateMarker({ leftButton, worldX, worldY }, originalEvent, c) {
const { tileLayer, tileMap } = this;
if (this.isSpriteStamp) {
return this.updateSprite(leftButton, worldX, worldY);
}
this.stamp && this.stamp.clear();
const tile = Math.floor(PhaserMath.random(0, COLLISION_INDICES.length));
const x = tileLayer.getTileX(worldX) * TILE_SIZE;
const y = tileLayer.getTileY(worldY) * TILE_SIZE;
if (leftButton.isDown) {
tileMap.putTile(tile, tileLayer.getTileX(x), tileLayer.getTileY(y), tileLayer);
this.updateNavMesh(1000);
}
}
const startAtY = 3;
const yLength = startAtY + 10;
let y = startAtY;
let xLength;
let x;
let tileIndex;
for (y; y < yLength; y++) {
x = startAtX;
xLength = startAtX + 20;
for (x; x < xLength; x++) {
if (x !== startAtX && y !== startAtY && x !== xLength - 4 && y !== yLength - 1) {
continue;
}
tileIndex = Math.floor(PhaserMath.random(0, COLLISION_INDICES.length));
tileMap.putTile(tileIndex, x, y, tileLayer);
}
}
}