Jump to content

Phaser version of PIXI's resources.data property


LukaszG
 Share

Recommended Posts

Hi,

I have an atlas JSON file with the frames object and the meta object, I would like with Phaser to gain the access to the meta object of the JSON atlas. In PIXI I did this like so:

_enemyResources = PIXI.loader.resources["assets/enemy-assets.json"];

and then to get to the meta object I could simply call

meta = _enemyResources.data.meta,

In Phaser, I'm loading this atlas as follows

this.game.load.atlas('enemy-assets', 
                     'assets/images/enemy-assets.png', 
                     'assets/images/enemy-assets.json', 
                     null, 
                     Phaser.Loader.TEXTURE_ATLAS_JSON_HASH);

but don't know how to get to the atlas JSON data, the loader object doesn't contain the data property (it is not mentioned in documentation) so I'm stuck,

I've tried the `this.game.cache.getJSON("enemy-assets")` but it didnt work.

 

Link to comment
Share on other sites

I'm still wondering how to get access to the meta object of the texture atlas but what I'm doing now is separating the atlas and data that conveniently I had in one file into 2 separate ones. Then I use json method of the Loader and then cache.getJSON(key) to retrieve the data.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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