Select the sprite that's behind

Hey, I have multiple path-finding sprites moving at the same time and I don’t want them to overlay one another.

In case a sprite is about to collide with another (distance between two objects) I want the one with the longest path forward to stop and wait. Or I can judge who’s behind by seeing which direction they’re both going and base on the direction, who should stop.

In theory this should be easy… in practice… I have two issues.
One: I don’t know how to select the two sprites that are colliding so that I
Two: can compare their path. I can’t compare paths directly, so the best I can do is probably the second option I listed above, but even then, how would I know an object’s direction? Best I can think of is to save an instances variable of where the sprite used to be so to judge in which axis it moved, but there’s an easier option, right?

Sorry for the delayed answer, did you find a solution to your issue?
Are these sprites multiple instances of a same object? In which case, it will be more difficult to handle.

I realized the question was a bit too vague so after a few days I re-formulated the question in another topic.

1 Like