Object parenting / hierarchies

Get help using Construct 2

Post » Wed Feb 05, 2014 8:18 am

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! :-)
B
6
S
3
G
2
Posts: 9
Reputation: 1,548

Post » Wed Feb 05, 2014 9:49 am

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.GeometriX2014-02-05 10:34:00
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Wed Feb 05, 2014 9:59 am

@Geometrix - can you check your link please ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Feb 05, 2014 10:34 am

Gah, sorry, it's fixed now.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Thu Feb 06, 2014 5:05 am

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!
B
6
S
3
G
2
Posts: 9
Reputation: 1,548


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 9 guests