Jump to content

Loading atlas


Fenopiù
 Share

Recommended Posts

Happy new year everyone!!!!!!

I'm starting this new Phaser year with a big question.

Is there a way to do at least one of those three things:

  • Have multiple keys for just one atlasJSONarray.json
{
 "frames1":
 [

  {
	"filename": "frame_x",
	"frame": {"x":0,"y":0,"w":246,"h":642},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":246,"h":642},
	"sourceSize": {"w":246,"h":642}
  },
  ...
 ],
 "frames2":
 [
  {
	"filename": "frame_y",
	"frame": {"x":0,"y":0,"w":642,"h":246},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":642,"h":246},
	"sourceSize": {"w":642,"h":246}
  },
  ...
 ],
 "meta":
 {
	"app": "http://www.codeandweb.com/texturepacker",
	"version": "1.0",
	"image": "frames.png",
	"format": "RGBA8888",
	"size": {"w":1904,"h":1926},
	"scale": "1",
	"smartupdate": "$TexturePacker:SmartUpdate:7501c1db9128f0a301bfd7fdbb041683:f12b9111dd99102df2878485c54440cc:8dfa5172c304a3afa731250a934e2d8d$"
 }
}

 

//Load things in "frames1" with key 'spriteframe1'
game.load.atlasJSONArray('spriteframe1'   , 'images/frames.png'   , 'images/frames.json');
//Load things in "frames2" with key 'spriteframe2'
game.load.atlasJSONArray('spriteframe2'   , 'images/frames.png'   , 'images/frames.json');

 

  • Loading multiple atlases in just one atlasJSONarray.json
{
 "frames":
 [

  {
	"filename": "frame_x",
	"frame": {"x":0,"y":0,"w":246,"h":642},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":246,"h":642},
	"sourceSize": {"w":246,"h":642}
  },
  {
	"filename": "frame_y",
	"frame": {"x":0,"y":0,"w":642,"h":246},
	"rotated": false,
	"trimmed": false,
	"spriteSourceSize": {"x":0,"y":0,"w":642,"h":246},
	"sourceSize": {"w":642,"h":246}
  },
  ...
 ],
 "meta":
 {
	"app": "http://www.codeandweb.com/texturepacker",
	"version": "1.0",
	"images": ["frames1.png", "frames2.png"],
	"format": "RGBA8888",
	"size": {"w":1904,"h":1926},
	"scale": "1",
	"smartupdate": "$TexturePacker:SmartUpdate:7501c1db9128f0a301bfd7fdbb041683:f12b9111dd99102df2878485c54440cc:8dfa5172c304a3afa731250a934e2d8d$"
 }
}
  • Have the same key for two different atlases who have data for the same sprite/sequence/animation/any
//Load all the frames in both files for my animation
game.load.atlasJSONArray('spriteframes'   , 'images/frames1.png'   , 'images/frames1.json');
game.load.atlasJSONArray('spriteframes'   , 'images/frames2.png'   , 'images/frames2.json');

 

Is it possibile at least one of this three things?

If yes, how?

Thanks for the answers guys!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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