Teach me JS and i will teach you how to think outside of box
You fail to to grasp concept of tools you have at your disposal
Z order i mentioned was not to give them proper z order
But use as means to control what happens to which card
Look
Imagine you fire a bullet
You want to make each enemy get hitted bullet but not spam damage so you want to create cooldown
So you could make timer or variable
I say fak both
I do not need to create something new when i can use what i already have
Condition
Enemy opacity = 255 (which is max)
Enemy in collision with bullet
NO TRIGGER ONCE NEEDED (so can be used in repeat for each)
Action
Change enemy opacity set to 254
Do you believe you will be able to even notice that opacity change?
Now
Condition
Enemy opacity = 254
Trigger once
Action
Change hp of enemy subtract 10
Wait 0.5sec
Change enemy opacity set to 255
And you just made invincibility frame for enemy
Out of opacity imagine that
So now that you understand basic concept
Let’s go with something as stupid as the above
This is example how to chain bullet attack
So imagine thunder
After thunder zap one enemy it finds next nearest enemy and zap him next
Have you ever seen such BS?

S stands for start and E for end i could shove in there Z X or A B
This is only there for me to tell apart where is start and end of each variable added to the list
Where i could limit it to just 1 but i was too lazy
Idea is If i add ID to string like imagine enemy 1 had ID 24
Enemy 2 had ID 41
We get 2441
Or 4124
But for now let’s assume only 2441
What i f i also have enemy with ID 1 and 2?
I proper order it would look like 224411
Can you tell in that string which number or sequence of numbers are for each object?
No?
How about now?
S2ES24ES41ES1E
Still no?
How about now?
S2E S24E S41E S1E
Now you see what i did?
I simply created string for each ball adding each ID var to that string with S on start and E on end
And now they can be read as separate numbers
Think of it as pointers in text i use to mark something
Now imagine (Back to your issue) you do same stupid crap with your objects
Give them ID vars
Now you have scene var
Object A is in Collision with object A
You add their ID vars to scene var with “S”+Object.ID+“E”
Now you can go with
https://wiki.gdevelop.io/gdevelop5/all-features/expressions-reference/#text-manipulation
StrFind(E) and StrFindLast(S)
To find end of 1st ID var and beginning of 2nd id var
Now you can set to another 4 scene vars position of object with ID var 1 and position of object with ID var 2
And now you have 4 vars which allow you to check distance or do whatever you want
Problem will start with more than 2 of same objects will collide with each other
BUT that is also doable i believe but that would depend on what you want to do with them
And if we are talking at multiple objects colliding with each other or pair but multiple pairs collision but at the same time
From here it will VERY VERY vary on what exactly you want to do and why