ramarro1 Posted February 25, 2014 Share Posted February 25, 2014 Hello, 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 faris re-creating all the stuff, remove the TilingSprite from stage and creatinga 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 thewhole stuff a bit. possible solutions imho are1) 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 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.