Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parenting Map Objects #1787

Closed
Lucrecious opened this issue Oct 18, 2017 · 1 comment
Closed

Parenting Map Objects #1787

Lucrecious opened this issue Oct 18, 2017 · 1 comment

Comments

@Lucrecious
Copy link

Lucrecious commented Oct 18, 2017

It would be super nice to be able to associate map objects with each other using parenting.

How parenting would work: All objects can either have one or zero parents. All objects can have any number of children. You can't parent an object to itself. You can't parent children to their recursive parent (no loops).
When a parent moves, the children copy its parent's displacement (recursively). When a parent rotates, the children copy its parent's rotation amount. i.e. If a parent moves 8 pixels up, all its children move 8 pixels up. If a parent rotates 80 degrees, all its children (recursive) rotate 80 degrees about the rotating parent.

Uses:
In the map editor it allows the user to manager multiple objects easily. In the code, it could help with associating objects with each other. i.e. A spawner that is associated with multiple types of monsters (all monsters are children to the spawner).

Implementation:
I think the biggest hurdle would be to find a good way to integrate this with the current .tmx structure. My idea would be to make it so every map object can also contain an object group (the children) and a parent object.

That, or each object have a list to the ID's of their children and a parent field with the id to their parent. That way we can leave it up to the library coders to implement the parenting in their own way.

Thoughts?

@bjorn
Copy link
Member

bjorn commented Oct 18, 2017

I'll close this issue since it duplicates #572.

I'm a little reluctant to actually introduce an object hierarchy, especially one that would apply the transform of parent objects to the children. This kind of hierarchy is not often seen in games as far as I am aware, though it is in graphics software.

It seems to me that the use-case presented by both you and @zilluss (in #572) would also be solved by introducing connections between objects (#707). That feature has the potential to be a lot more powerful than an object hierarchy, so it would be the direction I'd prefer to go in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants