Object parenting / hierarchies

0 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi,

    I've been searching the manual and the forums, but can't find a good solution for object hierarchies.

    What I want is this: If I make a container object, I'd like its "children" to move automatically when the container moves, but still be able to have "local" movement. Using "Pin" doesn't work, because it locks the trasforms of the children objects completely, and simply adding children to a container doesn't work either (they don't inherit the transforms).

    This is a really basic feature, and I was surprised Construct doesn't have it, since hierarchies can be used for so much more than the moving things around, you can organize very complex projects, use it to optimize performance, etc.

    But maybe I'm mistaken and there's a way to do it? Fingers crossed! :-)

  • Containers aren't parent/child groupings - they're flat, so there's no ownership or hierarchy. It's designed to allow for more convenient picking actions in events, as well as simultaneous creation/destruction of all items in a container.

    What you probably want is families. A family can be assigned a single behaviour, and when you use that behaviour (like setting bullet speed, or initiation custom movement or whatever), then all the objects within that family will perform that action.

    Here's an example that illustrates this. You'll see that the green block has the drag-and-drop behaviour, so only it can be dragged, but both blocks are moved together with the 8-direction behaviour which they inherit from their family.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • GeometriX - can you check your link please ?

  • Gah, sorry, it's fixed now.

  • That worked brilliantly.

    For some reason, I thought families were just used to group objects by "function", didn't think of it as a way to apply the same behavior. Now I know.

    Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)