feat: indexAt
This commit is contained in:
parent
9e083a26c3
commit
0984263edb
|
@ -60,6 +60,10 @@ export class Tiles extends decorate(class {}) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
indexAt(position) {
|
||||||
|
return this.width * position[1] + position[0];
|
||||||
|
}
|
||||||
|
|
||||||
packetsForUpdate() {
|
packetsForUpdate() {
|
||||||
const packetsForUpdate = this.updatePackets;
|
const packetsForUpdate = this.updatePackets;
|
||||||
this.updatePackets = [];
|
this.updatePackets = [];
|
||||||
|
@ -117,7 +121,7 @@ export class Tiles extends decorate(class {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tileAt(position) {
|
tileAt(position) {
|
||||||
return this.data[position[1] * this.width + position[0]];
|
return this.data[this.indexAt(position)];
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON() {
|
toJSON() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user