Same object in multiple containers?

Get help using Construct 2

Post » Mon Sep 16, 2013 4:05 pm

Hi all,

Is there any reason why I can't use the same object in multiple containers? Seems like a strange limitation?
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,940

Post » Mon Sep 16, 2013 4:24 pm

That would essentially be one container for all the objects.
So if one object (doesn't really matter which one) is destroyed then they all are.newt2013-09-16 16:27:41
Image ImageImage
B
171
S
50
G
179
Posts: 8,382
Reputation: 113,458

Post » Mon Sep 16, 2013 6:13 pm

@newt I'm not sure I follow.

Say you have two motorbike objects (red and green) and a single character object. If you add the character object to the red motorbike container, you can not add it to the green motorbike container.

The use case is hypothetical but explains my conundrum.
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,940

Post » Mon Sep 16, 2013 7:07 pm

Yes, that would place both motorcycles in the container along with the rider. Its like an unbreakable chain.
What you are wanting is something like the Object Pairer from Construct Classic. It could pair objects together for picking without the creation/destruction issues. I think its on the todo list.

The work around for now is storing the corresponding objects uid in an instance variable.

You can also try using IID, but that can get messy.


Or are you confused by the fact that you can not use one object as a parent if the other objects are already in a container?

I know I am.newt2013-09-16 19:20:06
Image ImageImage
B
171
S
50
G
179
Posts: 8,382
Reputation: 113,458

Post » Mon Sep 16, 2013 7:48 pm

[QUOTE=newt]
Or are you confused by the fact that you can not use one object as a parent if the other objects are already in a container?

I know I am.[/QUOTE]

Exactly! :)
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,940


Return to How do I....?

Who is online

Users browsing this forum: gameba and 26 guests