Search the Community
Showing results for tags 'creaturepack'.
-
Hello everyone. I am new to both pixi and creature. I am trying just to add a character with animation but i need it as optimized as it can be and to play on canvas. That is why i am trying to use the creaturePack instead of the json, and to use the js runtime instead of webassembly. I have been able to load the data but not render them. I am missing something about CreaturePixiJSRenderer.js. Any help would be appreciated I am posting the code and i will upload it in a repo in about an hour. Edit Could not share the repo so if anyone wants to take a look, the code is here http://www.dsarmis.gr/games/pixi-cr/p-cr.zip (PS. A server is needed in order to run) Edit var loader = PIXI.loader; var texture = null; var creature_pack = null; var creature_rend; var stage = new PIXI.Container(); var renderer = PIXI.autoDetectRenderer(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.view); renderer.backgroundColor = 0xffffaa; loader.add({name:"anim_data", url:"p3_setup_character_data.creature_pack", xhrType:"arraybuffer"}); texture = PIXI.Texture.fromImage("p3_setup_character_img.png"); loader.load((loader,resources)=>{ console.log(resources.anim_data); // Data exists creature_pack = new CreaturePackLoader(resources.anim_data.data); console.log(creature_pack); // Data exists creature_rend = new CreaturePackRenderer(creature_pack, texture); console.log(creature_rend); // Data exists creature_rend.pack_renderer.setActiveAnimation("default"); creature_rend.scale.set(100.0); creature_rend.timeDelta = 1; creature_rend.pack_renderer.syncRenderData(); stage.addChild(creature_rend); }); renderer.render(stage); p-cr.zip