Sebi Posted January 20, 2014 Share Posted January 20, 2014 Hi guys, I didn't look it up yet but I am curious if there is a way to access json data loaded via AssetLoader e.g. I have a spritesheet and I am loading it via PIXI. PIXI.AssetLoader(["spritesheet.json", ...]); Is that json file somewhere stored within PIXI or could you guys add the AssetData as argument to the onComplete? var loader = new PIXI.AssetLoader(['spritesheet1.json', 'spritesheet2.json']);loader.onComplete = function(assets) { console.log(assets['spritesheet1.json']);};loader.load(); Because sometimes I might want to know what was loaded. Imagine an Map Editor.1. Create a Map2. Pick a Tileset for that map.3. Request Tileset via PIXI4. Request Tileset via jquery5. Display available Tiles in DOM Or the other way around would work too (if you dont want to add an callback), but this approach would lack async loading because the json would have been loaded first before calling the assetloader. 1. Request tileset via jquery2. Pass json to PIXI asset loader <- in that case pixi would have to check if one of the asset urls is an object, if so -> create textures. if its a string -> do the regular stuff. Just curious.Cheers. Quote Link to comment Share on other sites More sharing options...
Sebi Posted January 20, 2014 Author Share Posted January 20, 2014 Another thing that came to my mind: If I have a spritesheet for each character class / npc / mob / whatever, would it be possible to reuse the json file for that spritesheet but with different skins (image)?That would reduce the amount of requests a lot. "spritesheet.json"-> "spritesheet1.png" -> Frames: spritesheet1_1.png, spritesheet1_2.png, spritesheet1_3.png-> "spritesheet2.png" -> Frames: spritesheet2_1.png, spritesheet2_2.png, spritesheet2_3.png Just for the case that you have a lot spritesheets that always follow the same pattern. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.