issues with zone triggering fixed
This commit is contained in:
parent
3e3a04d50e
commit
e792b75ad3
@ -116,22 +116,22 @@ export class GameMap {
|
|||||||
public setPosition(x: number, y: number) {
|
public setPosition(x: number, y: number) {
|
||||||
this.oldPosition = this.position;
|
this.oldPosition = this.position;
|
||||||
this.position = { x, y };
|
this.position = { x, y };
|
||||||
|
this.triggerZonesChange();
|
||||||
|
|
||||||
this.oldKey = this.key;
|
this.oldKey = this.key;
|
||||||
|
|
||||||
const xMap = Math.floor(x / this.map.tilewidth);
|
const xMap = Math.floor(x / this.map.tilewidth);
|
||||||
const yMap = Math.floor(y / this.map.tileheight);
|
const yMap = Math.floor(y / this.map.tileheight);
|
||||||
const key = xMap + yMap * this.map.width;
|
const key = xMap + yMap * this.map.width;
|
||||||
|
|
||||||
if (key === this.key) {
|
if (key === this.key) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
|
||||||
this.triggerAllProperties();
|
this.triggerAllProperties();
|
||||||
this.triggerLayersChange();
|
this.triggerLayersChange();
|
||||||
this.triggerZonesChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private triggerAllProperties(): void {
|
private triggerAllProperties(): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user