MasterQ32 Posted July 11, 2014 Share Posted July 11, 2014 Hello!I am currently working on a multiplayer game with PIXI and i'm trying to reload the level. But when i do, my code is failing to remove the previous level, but i don't really know why. The level is created into a separate stage that is used for rendering the whole level at once. So my approach was to just remove this stage from the main stage to remove the level: level.destroy = function () { for(var key in level.sprites) { level.sprites[key].alpha = 0.25; level.sprites[key].blendMode = PIXI.blendModes.ADD; console.log("dafuq?"); } console.log(level.stage); game.levelStage.removeChild(level.stage);}This should remove the stage and print some information.The information is printed, but the stage won't dissappear, neither the sprites get translucent. Can you give me any hint why this could fail? Resulting image RegardsFelix Quote Link to comment Share on other sites More sharing options...
xerver Posted July 11, 2014 Share Posted July 11, 2014 There should only be one stage per renderer. If you want multiple containers within the stage, use DisplayObjectContainers. A PIXI.Stage is the root of the scene graph, think of it as immutable within your renderer. You can have each "level" be a DisplayObjectContainer that is added/removed to/from the stage at will. Quote Link to comment Share on other sites More sharing options...
MasterQ32 Posted July 11, 2014 Author Share Posted July 11, 2014 Thanks for the hint! I solved the problem: I created each sprite twice as my initialization routine used an old method that called another method twice :/ Thanks anyway! 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.