I realize this is a nice-to-have, but would make using animations more plug-and-play:
When calling this.tilemap.removeTile(x, y, layer) (or "swap", "randomize", etc...), the corresponding this.tilemap.plus.tileAnimations[*].tileLocations[*] doesn't get "corrected".
I've currently got a crude external approach:
// keys: 23-27
// spear: 28
// dagger: 29
// money: 30
if (itemsTile && itemsTile.index >= 23 && itemsTile.index <= 30) {
this.tilemap.removeTile(
this.player.x,
this.player.y,
this.itemsLayer,
);
// remove rotating "key" animation?
if (itemsTile.index >= 23 && itemsTile.index <= 27) {
const anim = this.tilemap.plus.animation.tileAnimations.find(
animation => animation.frames[0].tileId === 22,
);
const ind = anim.tileLocations.findIndex(
location =>
location.x === this.player.x &&
location.y === this.player.y,
);
anim.tileLocations.splice(ind, 1);
}
}
But would be sweet to have removeTile patched to remove "any tileLocations at given coordinates where tileAnimations' frames contains index".
And while typing this, I just realized that I could just as well override TileMap.prototype.removeTile and make this less clunky...
Maybe I'll send along a PR 😜
I realize this is a nice-to-have, but would make using animations more plug-and-play:
When calling
this.tilemap.removeTile(x, y, layer)(or "swap", "randomize", etc...), the correspondingthis.tilemap.plus.tileAnimations[*].tileLocations[*]doesn't get "corrected".I've currently got a crude external approach:
But would be sweet to have
removeTilepatched to remove "anytileLocationsat given coordinates wheretileAnimations'framescontainsindex".And while typing this, I just realized that I could just as well override
TileMap.prototype.removeTileand make this less clunky...Maybe I'll send along a PR 😜