Jump to content



Recommended Posts



i have created a TilingSprite with 8 different piece of images, then making it  move on obj.tilePosition.y to achive a vertical infinite scroll.


to achive this i have do as follow (proof of concept, not the real script)

var img_count = 8;var img_num = 24;var _container = new PIXI.SpriteBatch();for (var i = 0;i<img_count;i++) {var s = PIXI.Sprite.fromImage("img/" + random%img_num + ".jpg");s.y = 200*i;_container.addChild(s);}var renderTexture = new PIXI.RenderTexture(200, 200 * img_count);renderTexture.render(_container);var ts = new PIXI.TilingSprite(renderTexture, 200, 200 * 3);
now, i want to change 3 images/tile of this rendertexture, what i have done so far
is re-creating all the stuff, remove the TilingSprite from stage and creating
a new one, adding all this to an array to keep track of what tile need to be 'swapped'.
Everything work quite well, my question here is if is possible to optimize the
whole stuff a bit.
possible solutions imho are
1) keep _container alive, and replacing only the icons that will change (need replaceChildAt, and not found it)
2) replacing texture for TilingSprite, without re-creating it and removing/adding from stage (not found how to do it)
all suggestions are more than welcome i am a noob on pixi :D
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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...