{"action":"created","issue":{"url":"https://api.github.com/repos/colinvella/phaser-tilemap-plus/issues/4","repository_url":"https://api.github.com/repos/colinvella/phaser-tilemap-plus","labels_url":"https://api.github.com/repos/colinvella/phaser-tilemap-plus/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/colinvella/phaser-tilemap-plus/issues/4/comments","events_url":"https://api.github.com/repos/colinvella/phaser-tilemap-plus/issues/4/events","html_url":"https://github.com/colinvella/phaser-tilemap-plus/issues/4","id":281025158,"number":4,"title":"`tilemap.removeTile` etc operations don't modify `plus.tileAnimations`","user":{"login":"nemoDreamer","id":9303,"avatar_url":"https://avatars3.githubusercontent.com/u/9303?v=4","gravatar_id":"","url":"https://api.github.com/users/nemoDreamer","html_url":"https://github.com/nemoDreamer","followers_url":"https://api.github.com/users/nemoDreamer/followers","following_url":"https://api.github.com/users/nemoDreamer/following{/other_user}","gists_url":"https://api.github.com/users/nemoDreamer/gists{/gist_id}","starred_url":"https://api.github.com/users/nemoDreamer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nemoDreamer/subscriptions","organizations_url":"https://api.github.com/users/nemoDreamer/orgs","repos_url":"https://api.github.com/users/nemoDreamer/repos","events_url":"https://api.github.com/users/nemoDreamer/events{/privacy}","received_events_url":"https://api.github.com/users/nemoDreamer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-11T13:56:38Z","updated_at":"2017-12-11T14:01:07Z","closed_at":null,"author_association":"NONE","body":"I realize this is a nice-to-have, but would make using animations more plug-and-play:\r\n\r\nWhen calling `this.tilemap.removeTile(x, y, layer)` (or \"swap\", \"randomize\", etc...), the corresponding `this.tilemap.plus.tileAnimations[*].tileLocations[*]` doesn't get \"corrected\".\r\n\r\nI've currently got a crude external approach:\r\n\r\n```js\r\n// keys: 23-27\r\n// spear: 28\r\n// dagger: 29\r\n// money: 30\r\nif (itemsTile && itemsTile.index >= 23 && itemsTile.index <= 30) {\r\n    this.tilemap.removeTile(\r\n        this.player.x,\r\n        this.player.y,\r\n        this.itemsLayer,\r\n    );\r\n\r\n    // remove rotating \"key\" animation?\r\n    if (itemsTile.index >= 23 && itemsTile.index <= 27) {\r\n        const anim = this.tilemap.plus.animation.tileAnimations.find(\r\n            animation => animation.frames[0].tileId === 22,\r\n        );\r\n        const ind = anim.tileLocations.findIndex(\r\n            location =>\r\n                location.x === this.player.x &&\r\n                location.y === this.player.y,\r\n        );\r\n\r\n        anim.tileLocations.splice(ind, 1);\r\n    }\r\n}\r\n```\r\n\r\nBut would be sweet to have `removeTile` patched to remove \"any `tileLocations` at given coordinates where `tileAnimations`' `frames` contains `index`\".\r\n\r\nAnd while typing this, I just realized that I could just as well override `TileMap.prototype.removeTile` and make this less clunky...\r\n\r\nMaybe I'll send along a PR 😜 "},"comment":{"url":"https://api.github.com/repos/colinvella/phaser-tilemap-plus/issues/comments/350732067","html_url":"https://github.com/colinvella/phaser-tilemap-plus/issues/4#issuecomment-350732067","issue_url":"https://api.github.com/repos/colinvella/phaser-tilemap-plus/issues/4","id":350732067,"user":{"login":"colinvella","id":1244038,"avatar_url":"https://avatars3.githubusercontent.com/u/1244038?v=4","gravatar_id":"","url":"https://api.github.com/users/colinvella","html_url":"https://github.com/colinvella","followers_url":"https://api.github.com/users/colinvella/followers","following_url":"https://api.github.com/users/colinvella/following{/other_user}","gists_url":"https://api.github.com/users/colinvella/gists{/gist_id}","starred_url":"https://api.github.com/users/colinvella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinvella/subscriptions","organizations_url":"https://api.github.com/users/colinvella/orgs","repos_url":"https://api.github.com/users/colinvella/repos","events_url":"https://api.github.com/users/colinvella/events{/privacy}","received_events_url":"https://api.github.com/users/colinvella/received_events","type":"User","site_admin":false},"created_at":"2017-12-11T14:01:07Z","updated_at":"2017-12-11T14:01:07Z","author_association":"OWNER","body":"You seem to have a good grasp of the code already! :)\r\n\r\nAs you figured out yourself, the system builds a structure that keeps track of the animated tiles. If you are confident you can submit a PR, please do go ahead! I think we should also look at other layer modification code besides removeTile(..)."}}
{"actor":{"display_login":"colinvella"}}