How do I remove single instance of objects containers

  • so this is my problem:

    i have an object called Enemy.

    this object is in Family called Enemies (doh).

    Enemy has a container with 2 more objects (for example - Foam and Flag).

    When i calculate health for enemies i use family Enemies so i cover each type of enemy (if there is more of em).

    And everything works as expected, but at one moment i have to remove objects from screen, those that are contained with Enemy because i swap Enemys default animation with something else. Therefore i have to remove other 2 objects from that Enemy with setting them to invisible (if i destroy them whole container goes away).

    And there is my problem - when i set those objects to invisible - if more then one Enemy is on screen, each enemy loses those objects, not just the one i've picked. (Yes i've used Pick instance by eval) - when my ball collides with enemy i call a function which passes Enemies.UID, and in function it does pick where Enemies.UID = function.param (0).

    blah i'm bothering too much, here's an image.

    Ashley - could you explain why this happens too? does it have something to do with families? containers don't go through families? (are not recognized)? i think containers could be expanded to gain a bit more functionality (or i'm doing a bad design)

  • I might be mistaken, but I believe picking by families ignores containers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • that's what i'm thinking, but that would be such a good feature to have :/

    gonna have to wait ashley to respond or someone else with idea... (i know workaround already but i want to get it as clean as it gets )

  • As a side note, you should probably use "Pick by unique ID" instead of "Pick by evaluation". I believe the former is a tad faster, and cleaner...

  • indeed, i didn't see that each object had pick by unique id.

    thnx

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