diff --git a/packages/topdown/tiles.js b/packages/topdown/tiles.js index e7e2409..60b86b3 100644 --- a/packages/topdown/tiles.js +++ b/packages/topdown/tiles.js @@ -58,12 +58,12 @@ export class Tiles extends decorate(class {}) { return Rectangle.compose([0, 0], this.size); } - setTileAt(x, y, tile) { - const oldTile = this.tileAt(x, y); + setTileAt(position, tile) { + const oldTile = this.tileAt(position); if (oldTile === tile) { return; } - const index = y * this.width + x; + const index = position[1] * this.width + position[0]; if (index < 0 || index >= this.data.length) { return; } @@ -99,8 +99,8 @@ export class Tiles extends decorate(class {}) { return slice; } - tileAt(x, y) { - return this.data[y * this.width + x]; + tileAt(position) { + return this.data[position[1] * this.width + position[0]]; } toJSON() {