Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Loading a Json who is in another Json in the Pixi.loader.shared


Mado
 Share

Recommended Posts

Hi,

I'm trying to load a Json form another Json loaded in the loader but don't know how to do.

loader
    .add("map", "../../assets/map/map.json")
    .load(setup);

It is a Tiled .json and inside there is the path to the "tileset.json", it looks like this :

 "tilesets":[
        {
         "firstgid":1,
         "source":"..\/tiled\/tileset.json"
        }],
 "tilewidth":32,

How to access this "tileset.json", how can I add it to the loader ? Knowing that I don't want to have to put it manually, I want the loader to find the json path inside map.json and load it.

Thanks.

Link to comment
Share on other sites

resource-loader, separated from pixijs: https://github.com/englercj/resource-loader/tree/release/3.x

Make a loader middleware.  I dont remember links to articles about it, but most people just deduce it from common pixi loaders:

SpriteSheetLoader: https://github.com/pixijs/pixi.js/blob/dev/packages/spritesheet/src/SpritesheetLoader.ts , downloads extra png file and waits for it

BitmapFontLoader: https://github.com/pixijs/pixi.js/blob/dev/packages/text-bitmap/src/BitmapFontLoader.ts , also loads extra files

In plugins:

spine loader: loads extra atlas file + png: https://github.com/pixijs/pixi-spine/blob/master/src/loaders.ts

pixi-tiled https://github.com/eXponenta/pixi-tiled/tree/master/src , find loader inside, look how it works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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