The parenting system is powerful in and of itself. Each child can inherit the events of the parent, or overwrite it. When using instance distance or finding options for finding a parent object, each child is considered their own parent, instead of individuals.
But when you have masses of interacting objects, like in RTSes or sandbox games, multiple parenting would be nice for easier programming. Unfortunately, one must jump through hoops with GML to do so.
I've created somewhat of three basic structures/theories for multiple parenting:
3 Multi-Parenting Examples Source
(The file is in .gm6
So the three theories in summary:
1. Father/Mother
Each child object's primary, default parent is called the "father". A child can also have a secondary parent called the "mother". When a child executes events, it does so it executes the father's events first, then the mother's.
Pros: event handling is seamless
Cons: mother parent does not affect instance finding functions
2. Dual Object/Overlay
Each child has a primary parent, and also a secondary parent. It creates the secondary parent as an invisible overlay instance. This helps so that the instance finding functions can still find both somewhat seamlessly.
Pros: instance finding functions(howbeit modified)
Cons: event handling complicated between two objects, double the memory needed
3. Combined
Simply, combining both theories.
Pros: instance finding functions, event inheritance
Cons: event handling may conflict between the two objects, double memory needed
How would you do multiple parenting in GM? Or are there alternatives? Would you ever need to have multiple parenting?












