Skip to content

Phaser ​

Packrat writes JSON Hash for a single-page atlas. If the atlas needs several pages, it writes one Phaser Multi Atlas JSON file that lists them. Phaser's texture loader applies the trim metadata.

js
class GameScene extends Phaser.Scene {
  preload() { this.load.atlas("atlas", "atlas.png", "atlas.json"); }
  create() { this.add.image(400, 300, "atlas", "player_0000"); }
}

For multiple pages, replace the load call with:

js
this.load.multiatlas("atlas", "atlas.json", "assets/");

Use the exported frame keys with this.add.sprite and this.anims.create to create animations. Serve the game and assets over HTTP, and choose an image format the browser can load.

See Sources and outputs for frame names, trimming, and effect maps.

Packrat documentation