feat: setTileAt

This commit is contained in:
cha0s 2019-03-25 20:49:16 -05:00
parent 0c2c9d53a9
commit 742228ec3f

View File

@ -23,6 +23,14 @@ class TilesBase {
return Rectangle.compose([0, 0], this.size);
}
setTileAt(x, y, tile) {
const index = y * this.width + x;
if (index < 0 || index >= this.data.length) {
return;
}
this.data[index] = tile;
}
slice(rectangle) {
const tilesRectangle = this.rectangle;
if (!Rectangle.intersects(rectangle, tilesRectangle)) {