xnamex Posted January 22, 2014 Share Posted January 22, 2014 Hi everyone, I'm extending the Phaser.Group Class, so I could have a 'views' manager, to handle the game states and being able to easily add/remove views as I go. I have some problems when removing the views(groups) from the game.Here's my GameView code:function GameView(game) { Phaser.Group.call(this, game); //calling init methods and other stuff - simple stuff}GameView.prototype = Object.create(Phaser.Group.prototype);GameView.prototype.constructor = GameView;..and here how I instantiate it, inside the create method:var view = new GameView(game);//and destroy itview.destroy();..and I get an error on mouse move: Uncaught TypeError: Cannot read property 'visible' of null So what am I doing wrong? Thanks, Link to comment Share on other sites More sharing options...
xnamex Posted January 24, 2014 Author Share Posted January 24, 2014 Well after several hours of digging I found this chunk of code, on the dev branch (https://github.com/photonstorm/phaser/blob/dev/examples/wip/group%20destroy.js) which I hope would fix the issue://The optional parameter here will destroy the Sprites as well as the Group.//The default is 'false' which means destroy the Group, but none of the children.group.destroy(true);So, until 1.1.4, idk, I'll have to wait and see. Link to comment Share on other sites More sharing options...
Recommended Posts