Family Rotate Independently

Get help using Construct 2

Post » Tue Feb 04, 2014 8:26 am

Hey guys!

I'm trying to figure out how to make each member of a family rotate toward the closest member of the same family. Does that make sense?

At the moment, the system just seems to realise that it itself is the closest member of the family, so it just looks at itself. This obviously isn't what I want it to do. I want to to exclude itself from the choices. I therefore tried to set it up so that it would allocate itself a number, and only check out family members whose numbers that were not equal to its own... but that's where I start to get confused, and it doesn't appear to be working.

Originally I did have it set up where players and enemies had their own families, and that worked great. The only problem I had is that I wanted certain aspects to work for both families, so I combined the two. It is important that I only have this working within a single family, so I hope someone can help.

I feel I'm close, but for all I know, I may be way off.

In any case, please find the attached summary example of what I'm trying to achieve.

Example
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 961
Reputation: 10,717

Post » Tue Feb 04, 2014 9:46 am

It seems what I'm actually looking for is "Pick second closest to".

Still no idea though...
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 961
Reputation: 10,717

Post » Tue Feb 04, 2014 10:27 am

I've had to make a copy of your family.( now there is a sentence I wasn't expecting to use today !)

capx - who is closest to me who is not me

because I have nested loop I have set this to only run every 0.05 seconds.
drag and drop added to family1 so you can move them around easy.

appears to work...
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Tue Feb 04, 2014 11:15 am

Thinking about this.

If this was taken into a function and only called as needed it would help. Also once all the family objects have the right direction then this function could be reduced from checking all the family1 objects to only checking any that are moving...

If you have 10 family objects then this will run 10*10 times - but if you only need to check 1 of the family then it would only need to run 10 times.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Tue Feb 04, 2014 11:16 am

Brilliant! You've helped me loads lately, so thank you very much indeed.

I've tweaked it slightly so that it will check the closest every 3 seconds to make it even less intensive, but it will retain the knowledge of who is closest and will look at them constantly (For at least 3 seconds).

Very clever. It will take me a while to actually get my head around, but it works great so far!
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 961
Reputation: 10,717


Return to How do I....?

Who is online

Users browsing this forum: alextro, stevenode, Yahoo [Bot] and 3 guests