feat: setTileAt
This commit is contained in:
parent
0c2c9d53a9
commit
742228ec3f
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user