Jump to content

PIXI Rope doesn't work with spritesheet frames? Is this a bug?


Tweeper
 Share

Recommended Posts

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);
Link to comment
Share on other sites

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!

 

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...