squilibob Posted May 9, 2018 Share Posted May 9, 2018 Can a spritesheet be loaded in the scene config or does it need to be in preload? I have a spritesheet that I have set up in my preload function preload: function() { this.load.spritesheet({ key: 'defaultavatars', url: '/img/avatars.png', frameConfig: { frameWidth: 256, frameHeight: 256, endFrame: 49 } }) } Is there a way I can add it in the scene config using the new pack declaration? pack: { files: [ { type: 'image', key: 'defaultavatars', url: 'img/avatars.png', frameConfig: { frameWidth: 256, frameHeight: 256, endFrame: 49 }} ] } Link to comment Share on other sites More sharing options...
rich Posted May 9, 2018 Share Posted May 9, 2018 Sure, you'd do it like this: pack: { files: [ { type: 'spritesheet', key: 'explosion', url: 'assets/sprites/explosion.png', frameConfig: { frameWidth: 64, frameHeight: 64, endFrame: 23 } } ] } squilibob 1 Link to comment Share on other sites More sharing options...
Recommended Posts