How can i detect points in another instance of itself

so i have this part of script:

it needs to change the animation when an other convayor is next to it so it shows the right sprite. but when i run it i get just 2 normal convayors.

its a factory builder game so i can give them all manualy a variable or something.

so how do i fix this!

Can you add more context? Is this something that only happens when an object is added or moved? Is it a chain reaction that relies on something else like a motor or do multiple conveyor objects just need to be next to each other?

Since you can’t check an object when it’s the only object picked with the for each object. You might be able to use a 2nd object as a collision tester or save the point in a scene variables, use pick all objects and then use the x, y from the scene variable.

We need more details first.

okay so, this script runs everyframe to check if the convayor has an nabouring tile on the point x,y so it can change its direction to connect the together

When possible, it’s best to limit loops like for each object to only when they’re needed. I tested this with the drag behavior. So, it only needed to test either when dragging or when dropped. I choose when dropped. Since the dropped condition picks the object that was dropped, I needed a pick all and to test it, I reset the animation to 0.

I used scene variables X and Y to save the point location. Since the for each object limits the pick to 1 object at a time, you would need a pick all to repick all of the objects. You then check the X, Y.

This version is similar. It changes the animation of both objects just in case. It uses a scene variable named Found. The pick all only modifies the pick list for that event (and any sub events) So, when it goes to the next event it uses the previous pick list that only had 1 object.

That’s pretty much the same question asked (and now answered) in this post, though it adds a couple more solutions to what @Keith_1357 has given.

Is there a school GDevelop assignment going on or something?