How do I make interact 3 same objects together

Get help using Construct 2

Post » Thu Apr 21, 2016 3:54 pm

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 ?
B
9
S
1
Posts: 59
Reputation: 609

Post » Thu Apr 21, 2016 4:46 pm

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
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Thu Apr 21, 2016 5:01 pm

Ah ! working very well
Thank you so much
B
9
S
1
Posts: 59
Reputation: 609


Return to How do I....?

Who is online

Users browsing this forum: grigrizljac, korbaach and 18 guests