Strange family movement behavior

Post your own tutorials, guides and demos.

Post » Mon Jan 26, 2009 10:07 pm

In this cap, the desired behavior is that the skeleton walk straight forwards until it hits the edge of the platform, and then turn around. Each skeleton SHOULD do this itself, ignoring the others.

What ACTUALLY happens is that as soon as one skeleton hits the edge, they ALL turn around and go the other way, in sync.

I'm told that my code should work. So what is going wrong?
B
2
G
3
Posts: 71
Reputation: 992

Post » Mon Jan 26, 2009 10:38 pm

How about this?

When using objects or families in condition that you want to alter, you have to [u:1o8knnrt]carefully define[/u:1o8knnrt] the conditions. "Else" picks all objects that have met the condition but haven't met the subsequent condition, i.e. the skeletons that are moving into the same direction.

Just negate the "is overlapping?" condition and it'll correctly pick the one only, thus change its angle.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Mon Jan 26, 2009 11:04 pm

But SHOULD else work that way? Especially when there's the for each object! Isn't it a bug? (Haha next ashley is going to say it's just how construct works and then Dave says it's bug after all, like last time... never mind, just joking ;D)
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Tue Jan 27, 2009 2:26 am

I -think- I understand what you're saying. I think it's bloody unintuitive, since I'd rather construct deal with one member of a family at a time, but I think I understand. Thanks for the help! I may disagree with how it works, but this is how it works, so I'll have to live with it.
B
2
G
3
Posts: 71
Reputation: 992

Post » Tue Jan 27, 2009 8:09 am

Let's go step by step...

We have 10 skeletons, the game checks their angle each tick. Say at the tick 3581 there are currently 5 skeletons facing right.

Okay, five skeletons have angle of 0, so those are picked. Next, we check for those skeletons if there is terrain 10 pixels away from them. Four skeletons meet that condition, so they move at set speed.

Now, there is ELSE condition, which picks CURRENTLY PICKED skeletons. Those are the ones that match the desired angle, so it turns them all, no matter whether they met the terrain overlap condition or not.

We want it to pick the skeletons that have no terrain ahead of them, so it picks THOSE skeletons. Thus, we have to make it an exact condition: Is NOT overlapping terrain at offset. That correctly picks the one skeleton who is about to fall off and turns him around.

If you have a clear idea which instances should be picked at any moment, it makes things easier :) ELSE doesn't pick anything, the PARENT condition picked instances are counted here. Perhaps if you kept the ELSE and added the "Not overlapping terrain at offset" condition there, that would work, as it would properly filter picked instances. But in this case, ELSE is not necessary, as we already have a condition that filters the stuff.

I hope I have been clear enough :)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Jan 27, 2009 12:18 pm

I know that, but the for each loop there should ELIMINATE that; it sould test them one at time, separately. I am not currently on my own comp so i can't see the cap but I think there was a for each loop? I'll check it later...
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Tue Jan 27, 2009 12:34 pm

Um, there is a bug with families in the current build.
Not sure exactly whats wrong with it but I know families aren't detecting other families.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Tue Jan 27, 2009 4:47 pm

it's bug after all, fixed next build :P Else now restores the Selected Object List to its parent's, making this example work as expected.
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Tue Jan 27, 2009 5:19 pm

Wow, I have cleary some insight how Construct should work ;D
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Wed Jan 28, 2009 3:49 am

I remember I had that problem and I was supposed to put it on the tracker......
opps I knew i forgot something in that end of semester rush to get everything done.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests