Jump to content

Sprite Sheet for images only


alflashy
 Share

Recommended Posts

Hi,

I want to load multiple images which currently I am loading individually from JSON with for loop in Preload and Create function like this below. Its loading about 20/25 images and I want to know whats the best way to load these images. I looked in sprite sheet and atlasXML but looks like its more for Animation and not not for static images. 

http://examples.phaser.io/_site/view_lite.html?d=animation&f=multiple+anims.js&t=multiple

image.thumb.png.310baf1ac6f5773851cc8502ac34123b.png

Thank you

Link to comment
Share on other sites

Hi @alflashy,

For better graphic performance and save http calls to the server, use a spritesheet is a good idea:


// In your preload function

 game.load.atlasJSONArray('atlas_key','myAtlasImage.png','MyAtlasJsonFile.json');


// In your create function

 var Image1 = game.add.image(0,0,'atlas_key','frameName1');
 var Image2 = game.add.image(50,50,'atlas_key','frameName2');
  /* ....................... */

To create the spritesheet I use:

https://www.leshylabs.com/apps/sstool/   (select the "JSON-TP-Array" format)

Regards.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...