[Solved] Reach through links

This extension: Linked Objects Tools - GDevelop documentation

About the condition “Can reach through links”

I want to know, can I use it to check against the same object?

For example “Object1 can reach Object1 through links”

Will it work? I want to pick all instances of an object that can reach through links to another instance of the SAME object.

Did you solve this? How? I was going to test picking instances with something like an object variable.

1 Like

I realized that I don’t need link stuff, I can just “link” them like this:

  1. Give every instance an individual ID (1, 2, 3…);

  2. Give them an empty array;

  3. To link two instances, just add the ID of the instance you want to link to the array of the another instance;

  4. Now you have an array variable containing all “links”, that you can iterate converting it to a scene variable and checking for the ID existence.

1 Like

That sounds interesting. It’s a shame they still haven’t added for each child for global and object variables. What if you leave the arrays as a scene variable? Maybe an array of arrays.

You inspired me to create an odd project. It might not work in your situation but it’s an interesting concept that I’ll keep in mind.

Instead of an array, I used IDs as letters instead of numbers. I then used the condition the text of links objects variable contains the ID. I’m probably not explaining this well.

each object has a text variable that contains an IDs as a letter and a links variable that contains like “ac”. You can then check if it contains something like “a”.

I used it to draw a polygon by “linking” the adjacent objects using the letter before and after the current letter.

try me: The objects are draggable.

project:

1 Like