I am designing a game that has 100+ pieces. They are all have simple definitions and I am considering a dynamic creation of the pieces rather
than static definitions. They will be associated with individual static locations
on the playing surface. I thought reparenting of the visual parent will solve
some problems. And since they will be dynamically created my understanding is that the instantiating object will still own the physical instances.
Now I wonder, in my example, Was the reparented object's physical parent property also moved with the visual parent? Since the child elements are
dynamically generated they don't have any id values. So where do I destroy
them? Do I destroy (or modify) them under the generating object or the visual parent? and how do I obtain access to them?
My first thought was the "children" property
of the parent object. The children property seems to be a JS array. It does have a "length" attribute which keeps track of the number of children. But trying to
access child object via " parent.children[ x] " does not seem to work.
How do I access reparented objects without any id property? Do I do it from the physical parent or the visual parent? And what parent property do I use to access the object and its properties?