voidstar Posted February 23, 2017 Share Posted February 23, 2017 My game has multiple game states (ie levels) and each game state has a root container to which all further pixi objects are children off. When swapping game states I wish to clean up all the objects that were part of that state but leave the base textures in tact for future use. If I call destroy(true) on the root container so that it destroys itself and all it's children then it also destroys all the base textures used by those children which means I'd have to reload all my assets when swapping states. Is there a way I can destroy everything attached to the root container but leave the base textures untouched? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 23, 2017 Share Posted February 23, 2017 Destroy also can accept an object { children: true, texture: false, baseTexture:false } http://pixijs.download/dev/docs/PIXI.Container.html#destroy Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 Oh sweet. I'm using a typescript wrapper around PIXI and the object param version hasn't been defined there so I missed it. Thanks for that Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 23, 2017 Share Posted February 23, 2017 if you use latest (https://github.com/pixijs/pixi-typescript ) and not [email protected] , it'll be there. I think. We are experiencing some problems with [email protected] Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 I think my version might be out of date. I'll update and see how I get on Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 I just grabbed the latest version and I'm getting lots of compile errors with it which I wasn't getting with v3. Everywhere null is used I get a "BuildL Type expected" for example Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 23, 2017 Share Posted February 23, 2017 What version of typescript do you use? Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 Heh good question. The one that comes with VisualStudio 2015 since that's what I'm using. I can't remember setting this stuff up but seem to think it just worked out of the box. How do I grab and install the latest version into VS2015? Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 I'm applying a VS2015 update now, apparently typescript 1.7 should be included in that Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 23, 2017 Share Posted February 23, 2017 We need 2.0 or 2.1 Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 Cheers for the help. I think I've found an installer for it. Just have to wait for VS to finish installing its updates Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 Ok I got the update to work but I have two issues. Firstly I don't seem to be able to set the default texture scale mode anymore, it's now a read only property. What's the correct way to do this in v4? Secondly, upgrading my typescript version has broken intellisense in Visual Studio 2015 which now refuses to understand any PIXI code regardless of the fact I've updated the proj files, rebuilt the code, and cleared the cache. Has anyone encountered this before? Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 Ok it looks like what I downloaded was typescript 2.2. Would this be the reason for any of the problems I've mentioned? I'm thinking of just going back to PIXI v3 at this point Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 Going back to PIXI v3 fixed the issues with intellisense. I'm guessing PIXI v4 isn't yet compatible with typescript 2.2 and in typical Microsoft fashion if I try to download installers for typescript 2.0 or 2.1 from their website they keep giving me version 2.2 instead. Guess I'm stuck with v3 for now Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 Sorry for all the updates but I just keep running into problems. I gave upgrading another crack by uninstalling typescript completely and installing version 2.2 (the only version I can get my hands on). This seems to have fixed the intellisense issues with PIXI v4. However I'm still getting an error when trying to set the scale mode. This code: PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; results in the error: Quote Cannot assign to 'SCALE_MODE' because it is a constant or a read-only property. Does anyone know why this is and how I get around it? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 23, 2017 Share Posted February 23, 2017 (PIXI.settings as any).SCALE_MODE = PIXI.SCALE_MODES.NEAREST; post it as an issue in pixi-typescript github page, please. Quote Link to comment Share on other sites More sharing options...
voidstar Posted February 23, 2017 Author Share Posted February 23, 2017 I have done, thanks for the help 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.