tilemap
tilemap copied to clipboard
Where is atlas_image taken from
Hello there,
I am trying to understand and apply what you are showing in the demo in my code and I don't understand what you're trying to access. This is the following line I am struggling with.
var tilemap = new PIXI.tilemap.CompositeRectTileLayer(0, [resources['atlas_image'].texture], true);
In particular where the atlas_image is being set-up or how it is being called. I can see in the repo that atlas.json is a TexturePacker json file which you load right at the very beginning with loader.add('atlas', 'basic/atlas.json'); but I cannot see the connection between the two.
Maybe once I understand this I might be able to help to improve the documentation to help other people understand it too?
if you add json atlas named "atlas", PIXI creates image "atlas_image" in resources, which is PNG referenced in the atlas. Its pixi inner thing :)
Let me know if you have some other questions.
Thanks for the response, I realise now that yes this is PIXI and not something specific to the tilemap add on but thankyou for the explanation. Does it just add "_image" to whatever you name it in the resource or is there something more complicated going on here? If this behaviour is not documented somewhere then I will see if I can find the right place to add something and then send a contribution.
Yes, only '_image'. The other way is to ask json atlas itself
resources['atlas'].textures['any_texture_inside_atlas.png']
That will add whole atlas too, but i dont want to specify some texture name.
https://github.com/pixijs/pixi.js/blob/dev/src/loaders/spritesheetParser.js#L12
if you use pixi-spine, it will also create two dependant resources - one for atlas file, one for png
I know its not verbose, its not appearing in PIXI docs at all, whole Loader module is kinda not obvious
Hello, I know it's been a few years since this issue, but I see this library is still being maintained. However, the documentation really could use an update to clarify that bit about pixi doing a bit of "magic" for the atlas_image thing. I spent probably a few hours looking at docs, example implementations, etc before I happened upon this issue and now understand. Pixi is new, altogether, for me so between version/api changes in both documentation and examples online it has been difficult to know what is > 5.0 implementation or not just from looking.
Could you please update the documentation - even if just a mention that pixi does this for you internally?
Great library and effort in what the team does with pixi and it's modules, thank you!
In v5 there's even special behaviour - if "atlas_image" already added, it wont be added second time.
OK, moved it to issue in main repo. I'm not the docs guy and spritesheets is not my area.