clark Posted February 21, 2014 Share Posted February 21, 2014 Hey everyone. So think of a Garden which contains a Tree which contains an Apple. Garden extends State-Tree extends Group--Apple extends GroupThe problem I am having is with the parent of the apple group. In TreeGroup we want to create a new AppleGroup:Pseudo: this.appleGroup = new AppleGroup(this.game, this);Well the problem I am having is that firstly I do not want to have a parent yet. I want to create an AppleGroup with all its AppleSprites. But I do not want them on the tree until later. Can you confirm this is not possible? That a group must always be added to the display list on instantiation?If parent is ignored from the above code, then I still see my apple. So I guess that my appleGroup is given the world instance. The interesting thing though is that in either case, regardless of what I pass as the parent: this.appleGroup = new AppleGroup(this.game, this);console.log(this.appleGroup.parent) //undefinedthis.appleGroup = new AppleGroup(this.game);console.log(this.appleGroup.parent) //undefinedBut I can see my AppleGroup on the canvas. Does anyone know what is happening here? This problem is regarding my MenuScreen during gameplay. I want to create the Screen as part of the UI Instantiation, so later, I can add/remove it from the UI group. Link to comment Share on other sites More sharing options...
rich Posted February 21, 2014 Share Posted February 21, 2014 You probably ought to read this: http://www.html5gamedevs.com/topic/4052-adding-to-group-without-adding-to-stage/ clark 1 Link to comment Share on other sites More sharing options...
clark Posted February 21, 2014 Author Share Posted February 21, 2014 Oh yeah! I spent lastnight looking for the answer on the forums and posted it first thing this morning. What are the chances of the exact question popping up in that time Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts