TrinityCore Posted May 19, 2018 Share Posted May 19, 2018 Hey guys! I would like to know how I could remove a set of objects without needing to do it 1 to 1 ¿why is this? I have created one poster, and this consist of 4 parts: Background, title, image and description. When I need to remove this object, it turns out that only the background is removed, but everything else remains. My Code: this.Tooltip = Game.PhaserGame.add.graphics(); this.Tooltip.beginFill(0xffffff, 1); this.Tooltip.drawRect(10, 10, 500, 250); this.Tooltip.endFill(); this.Tooltip.wanted = { title: Game.PhaserGame.add.text(0, 0, "¡WANTED!", {font: "bold 32px Arial", boundsAlignH: "center", boundsAlignV: "top", fill: "red"}), //image: Game.PhaserGame.add.sprite(0, 0, 250, 200, "wanted"), description: Game.PhaserGame.add.text(0, 0, "We are looking for this man", {font: "bold 16px Arial", boundsAlignH: "center", boundsAlignV: "middle", fill: "red"}) }; this.Tooltip.wanted.title.setTextBounds(10, 10, 500, 250); this.Tooltip.wanted.description.setTextBounds(10, 10, 500, 250); As you can see, what I need is to create a "parent" object that contains all the information so that when the object is deleted, it is deleted in its entirety, that is, I do not want it to be there (not hidden, deleted). ¿Is this possible? Link to comment Share on other sites More sharing options...
samme Posted May 19, 2018 Share Posted May 19, 2018 Use a Group instead, with add and destroy(true). Link to comment Share on other sites More sharing options...
TrinityCore Posted May 20, 2018 Author Share Posted May 20, 2018 13 hours ago, samme said: Use a Group instead, with add and destroy(true). Maybe I have not explained myself well. ¿What i need? I need to create a "cosmic" object that is capable of containing many other objects of all kinds. To thus "Modulate" an object and that it acts as the total thereof. Making that ... when eliminating the "Cosmic Object", all the objects belonging to it are also eliminated. ¿is it possible? Link to comment Share on other sites More sharing options...
samme Posted May 20, 2018 Share Posted May 20, 2018 var poster = this.add.group(); var tooltip = poster.add(this.add.graphics(/*...*/)); var title = poster.add(this.add.text(/*...*/)); var description = poster.add(this.add.text(/*...*/)); // ... poster.destroy(true); TrinityCore 1 Link to comment Share on other sites More sharing options...
TrinityCore Posted May 20, 2018 Author Share Posted May 20, 2018 3 hours ago, samme said: var poster = this.add.group(); var tooltip = poster.add(this.add.graphics(/*...*/)); var title = poster.add(this.add.text(/*...*/)); var description = poster.add(this.add.text(/*...*/)); // ... poster.destroy(true); Thanks! its cool! ? Link to comment Share on other sites More sharing options...
Recommended Posts