How do I remove single instance of objects containers

Get help using Construct 2

Post » Thu Oct 01, 2015 6:13 pm

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)


Image
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
42
S
14
G
12
Posts: 624
Reputation: 9,421

Post » Thu Oct 01, 2015 6:28 pm

I might be mistaken, but I believe picking by families ignores containers.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Thu Oct 01, 2015 6:29 pm

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 )
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
42
S
14
G
12
Posts: 624
Reputation: 9,421

Post » Thu Oct 01, 2015 6:39 pm

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... ;)
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Thu Oct 01, 2015 6:46 pm

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

thnx :)
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
42
S
14
G
12
Posts: 624
Reputation: 9,421


Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu, Yahoo [Bot] and 8 guests