Tweeper Posted April 15, 2015 Share Posted April 15, 2015 Hi to all, Today I was trying to optimize my code by combining images into a spritesheet. I'm used to do this with PIXI and it always works fine. But now I use the imagecombining together with PIXIs rope for the first time. The rope is working fine with a single image file. I would expect this would work with a spritesheet-frame instead just by replacing the texture from file into texture from frame. But it's not showing as expected... After the switch the rope still works, but displays the full baseTexture (spritesheet) instead of the single cutout part (frame). I had some struggle, but whatever I tried I can't get the rope to work together with the fromFrame texture. Is this a bug in PIXI (I find that hard to believe)? Or am I missing something here? BTW: The points-array code I didn't change. And I'm using the at the moment latest PIXI: 2.2.9 var points, rope; var segments = 14; var imgWidth = 980; // px frame var length = imgWidth / segments; // DEFINE POINTS points = []; for (var i = 0; i < segments; i++) { points.push(new px.Point(i * length, 0)); } // DEFINE ROPE rope = new px.Rope(px.Texture.fromFrame(snakesettings.imgID), points); // DOESN'T WORK: USES FULL BASETEXTURE FOR SOME REASON// BEFORE THIS WAS WORKING FINE WITH SEPERATE IMAGE FILES: px.Rope(px.Texture.fromImage(snakesettings.imgID), points); rope.x = - imgWidth / 2; // center x // DEFINE CONTAINER var ropeContainer = new px.DisplayObjectContainer(); ropeContainer.addChild(rope); Quote Link to comment Share on other sites More sharing options...
Tweeper Posted April 21, 2015 Author Share Posted April 21, 2015 Sorry for not answering all responses... too much to handle Anyhow: in case somebody's interested: after a lot of trying it still could be I'm missing something here, but it seems like a bug to me.Posted it here: https://github.com/GoodBoyDigital/pixi.js/issues/1691 Quote Link to comment Share on other sites More sharing options...
Tweeper Posted April 21, 2015 Author Share Posted April 21, 2015 Alright. fromFrame isn't implemented in rope (yet) according to the quick reaction from Mat Groves: Using sprite frames could be possible but is not currently implemented in pixi. For now its best to use separate images. There would be no real advantage / performance boost from using images in a sprite sheet for a rope as each one is a seperate draw call anyways. hope that helps! 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.