Loading the texture atlas

To get the texture atlas into Pixi, load it using Pixi’s loader. If the JSON file was made with Texture Packer, the loader will interpret the data and create a texture from each frame on the tileset automatically. Here’s how to use the loader to load the treasureHunter.json file. When it has loaded, the setup function will run.

  1. loader
  2. .add("images/treasureHunter.json")
  3. .load(setup);

Each image on the tileset is now an individual texture in Pixi’s cache. You can access each texture in the cache with the same name it had in Texture Packer (“blob.png”, “dungeon.png”, “explorer.png”, etc.).