So let's say you have an item "box" which is a sprite.
You have 3 "box" in your layout.
Those "box" are overlapping each other, and I would like to make them interacting to each other this way :
If a box is overlapping another box on the left, it goes 1 pixel on the right
If a box is overlapping another box on the right, it goes 1 pixel on the left
Currently, I have this :
"box" is overlapping "box" at offset -1, 0 : Set X to Self.X+1
"box" is overlapping "box" at offset 1, 0 : Set X to Self.X-1
Which is working fine for 2 item, but not 3 or more.
For each doesn't work either.
Any advice ?
Develop games in your browser. Powerful, performant & highly capable.
For this I like to use a family with box in it. I'd name the family "otherbox".
for each box
--- box overlaps otherbox at offset (-1,0) : box set x to self.x+1
--- box overlaps otherbox at offset (1,0) : box set x to self.x-1
Ah ! working very well
Thank you so much