I’m trying to get a hold of how to parent objects in GDevelop, I made a small little test to try and figure it out. As you can see, I made a blue dot, and a red dot. The red dot (the child) is supposed to follow the Blue dot (the parent), but it only follows the parent created. All other red dot children that are created, are following the original parent, or the first blue dot. The goal is for each child to follow each parent
You don’t need that for each orb as the child event - there is only one orb that GDevelop deals with at that point, and that will be the one just created.
However, you should use the for each as a parent event of the
Take into account all Child linked to orb event.
I just wanted to say I’ve been racking my brain for over 3 days trying to figure this out. Your code works. :)) So Gdevelop picks the object just created. So you create a Parent and a Child, then Gdevelop focuses on the child since it was last created. So by linking we tell Gdevelop “pick a child whenever you pick it’s parent” and then, because of that, when we add force or set the position of the child, Gdevelop modifies both? It’s hard for me mentally to keep track of what the engine sees when it comes to object instances. I can really go down a rabbit hole trying to keep track. lol But thank you very much. Is there anything I can help you with?
My rule of thumb is that the starting point is all instances of an object are available to all events.
The object instance eligibility in an event (and it’s child/subevents) is reduced to all those that meet the event conditions.
The same applies to objects created - they are the only instances of the objects available in the event and any child/sub events.
Just the thing nearly all devs need help with - art and animation ?
Just to add my 2 cents. Linking works just as a reference. Nothing more. The objects are still independent. If you want both to move then you need to change both objects position or apply some form of force.
It’s a bit like a family tree. Once linked you can pick the objects linked to another object. The order of the search matters. It’s either picking the child objects linked to 1 parent or the parent objects linked to 1 child object. There are no real parent or child objects. The linking is equal. It works in both directions. I’m just trying to use a family tree as an example.