htmlobjectcontainersvisibleconstruct-2

Container in Construct 2 doesn't make all objects visible


I thought that the action you apply to one object of a container is automatically applied to every object in the container, but this doesn't seem to be the case in my project:

By making 1_br_ok_e visible, I would axpect the other two objects in the container to be made visible too, but nothing happens, only 1_br_ok_e becomes visible.

enter image description here

What am I missing?


Solution

  • No this isn't how containers work.

    I am quoting from the Scirra documentation (https://www.scirra.com/manual/150/containers):

    Placing objects in a container has the following effects:

    1. If one object in a container is created, every other object in its container is also automatically created.
    2. If one object in a container is destroyed, every other associated object in its container is also destroyed.
    3. If a condition picks one object in a container, every other associated object in its container is also picked.

    And that's it. Nothing else should be expected from containers.

    In your case, destroying the object (and consecutively the whole container) could be an option if you never need them to reappear.

    To support Scirra on this, I want to add that maybe in your case this could be a positive feature, but in most cases it's not a desirable functionality. Imagine creating a tank container where you have the tank's body and its turret. Rotating the turret would make the whole tank rotate, since the body would share the same action. You would have no way to make this work.