• Content Count

  • Joined

  • Last visited

  1. So, I've been back and forth with different techniques, trying to get a JSON texture atlas to load a tile sheet of animations for each "type" of animal in this game. But trying to wrangle what's valid from what's invalid according to v3 (over much of the "outdated" v2 tutorials and such). Can someone tell me how the JSON object gets loaded by the loader, but the textures are not in the textureCache??? This code was modified from a v3.0.1 tutorial This is the error I get Uncaught Error: The frameId "walk01" does not exist in the texture cache This couldn't be a CORS problem could it? I mean the images are in a sub-directory within the same server/project. Is there a (yet another) new way to handle this? My brain feels like jello trying to figure this out.var animalTypes= [ {"typeID": 0, "name": "creeper", "tilesheet": "animalAssets/animal0.png", "JSON": "animalAssets/animal0.json"}, {"typeID": 1, "name": "sleeper", "tilesheet": "animalAssets/animal1.png", "JSON": "animalAssets/animal1.json"}];function Animal(id, type, speed, start){ var aID = id; var aData = animalTypes[type]; // References a JS Object literal with the "DATA" var aSpeed = speed; var aPosition = start; var FRAMES = [ "walk01", "walk02", "walk03", "walk04", "stand01", "stand02", "stand03", "stand04" ] var frameIndex; var frameTime; var FRAMERATE = 0.08; var VELOCITY = 0; PIXI.loader.add('animal'+ aID, aData.JSON).load(function () { var texture = resources["animal" + aID].textures; console.log(resources.animal0.textures); // SHOWS ARRAY OF TEXTURE OBJECTS NAMED AS ABOVE }); var aSprite = new PIXI.Sprite(PIXI.Texture.fromFrame(FRAMES[0])); frameIndex = 0; aSprite.anchor.x = 0.5; aSprite.anchor.y = 0.5; aSprite.position.x = 0; aSprite.position.y = 0; stage.addChild(aSprite);}var newSprite = new Animal(0,1,1,1);
  2. So how does this now work in v3 since the AssetLoader has been deprecated?
  3. Someone help me ... JSON loading is causing me all kinds of stress with simple MovieClip loading and TextureCache errors all over the place!!! ARGH!

  4. Pixi.js 3.0.7 - ✰ WebGL ✰ ♥♥♥
  5. I see false returned from this. PIXI.loader.add('key', 'someImage.png').load(function (loader, resources) { // this will log "true", they are all the same: console.log(PIXI.loader.resources === loader.resources === resources); // resources is an object keyed by your names, you can get the loaded // texture like: console.log(resources.key.texture);});Also, PIXI.loader is comming back undefined ... any clue what the issue might be? I'm a PIXI noob, but am rather far along with Javascript, so this is kind of baffling.