How do I parent an object in GDevelop and is it still in GDevelop?
So basically, I want to add a username and I tried to join it with the user input and when I held the jump button the text went up and stayed up. I heard that there was a feature in gdevelop that allows an object to be parented, now I have played with parenting with other game engines and I’m guessing there is a parenting feature, so is it true and if so, how do I use it?
Hello!
The concept of object parents does not exist in the engine. As far as I can find, there wasn’t object parents in GDevelop 4 either, so the answer to “Is it still in” is no because it never was in.
That said, you could use the link object conditions and actions to associate two objects together, but note that links are just referential (they don’t do anything automatically, it just lets you say "take into account only objectA linked to ObjectB in conditions or actions), and they’re two way, there isn’t a “Parent” in a link relationship.
Is there even a way I can lock the position with the player and the username?
Link the created text object with the player object, then have an event that is “For each Usernameobjecthere object” event type, with the condition of “Take into account all Usernameobjecthere linked with PLayerobject here”, and the action to position the username object based off the player object (I’d recommend the “position object around another” action).
You will have to use linking otherwise all usernames will just look for the first player object it can find and attach to that (the same first object).
I would probably use the condition version of linking instead of the action. Also note that you need to link the objects together in the same event you create them.
If you are precreating the objects in the scene editor, this method won’t work.
You can read more about object lknks and see some examples here. Linked Objects [GDevelop wiki]