Picking question (added cap file)

For questions about using Classic.

Post » Tue Jul 14, 2009 3:13 am

I have 3 sprites: A, B and C all in a container. Sprites A and B are in a family called "blue." I have a condition that picks "blue" when it's private variable health=0. In a sub condition, I try to pick Sprite C when its private variable state<100, but it seems to pick every instance of Sprite C matching that condition, not just the ones where Blue=0 and C<100. I don't understand picking 100% but i think that should work...or is something wrong with that logic? I'll set up a cap if that explanation is confusing.
Thanks for any help.
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Tue Jul 14, 2009 3:34 am

As far as I know, it won't work that way. Families and objects are on a separate level as far as the Selected Object List goes. To get the benefit of containers, you need to pick an actual object in the container. If you pick by family, then there is no container attached to the family itself.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Jul 14, 2009 4:03 am

Ah got it, thanks deadeye. For some reason I thought it picks the sprite in the family that matches the condition.
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Tue Jul 14, 2009 5:10 pm

The way containers work is if any instance in the container is picked, even via a family, the entire container is picked. This means it's actually not possible to pick one object in a container without picking the rest of the container, no matter how you do it. That's the intended way, anyway, there might be a bug. Posting a .cap always helps.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Jul 14, 2009 6:19 pm

Hmm..then if i understand it correctly, the events I originally posted should work. I'm picking instance A via a family, then trying to pick instance C which is in a container with instance A. I'll post a cap when i'm home to see if it's a bug or not.
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Tue Jul 14, 2009 6:25 pm

Oops, I guess I was wrong :oops:
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jul 15, 2009 1:20 am

NP deadeye :)

There only seems to be a bug in my game, maybe some junk left over after saving in different versions of Construct. I set up a similar situation in a clean file in 99.4 and it works as expected, picking from the family and then picking the instance in the container.

I'll just recreate the families and containers in my game and hopefully that will fix it.
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Wed Jul 15, 2009 7:44 pm

Well after not being able to get this working in my game, i set up another file and the picking doesnt seem to be working.

Here is the cap: [url:30i6rj8x]http://www.louisferina.com/games/families.cap[/url:30i6rj8x]

The 2 blue sprites are in a family "blue". The red square is in a container with the blue sprites.
Left clicking will spawn a bullet traveling to the right. When it hits the blue sprites, it deletes the red square which will also delete the blue sprites in the container. One container of sprites should remain but for some reason both get deleted. I think that's a bug.
B
77
S
49
G
25
Posts: 346
Reputation: 17,409

Post » Sat Sep 05, 2009 8:06 pm

I think I've encountered the a similar problem (so I think) with families and containers.

I have families A,B,C and D and want to always set the positions of B,C and D to the position of A. Objects of the from families A,B,C and D are always grouped in a container.
When I first tried this objects from different containers were positioned together in a mixed up manner (however still one object of family A,B,C and D each).
However changing the Z order seems to solve this problem. I just made sure that objects in the same container are directly subsequent to another.
It's a bit of a hack, but it could help people who have similar problems to the one I had.
Families and containers have difficulties with one another.
(I'd still like an object that could have other objects as private variables...)
B
1
G
3
Posts: 5
Reputation: 835

Post » Sun Sep 06, 2009 2:54 am

I thought those were new posts by deadeye, where is that man!? :cry:
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests