Chained Asset Pack Loading
Demonstrates how to load multiple asset packs recursively, where one JSON pack file triggers the loading of another.
800 × 600
class Example extends Phaser.Scene
{
preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
// This pack will load pack3.json as well
this.load.pack('pack1', 'assets/loader-tests/pack2.json');
}
create ()
{
this.add.image(400, 300, 'taikodrummaster');
this.add.image(400, 500, 'sukasuka-chtholly');
this.add.image(200, 300, 'makoto');
this.add.image(400, 400, 'nayuki');
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
width: 800,
height: 600,
parent: 'game-container',
scene: Example
};
const game = new Phaser.Game(config);