Comparing the X position of two instances?

For questions about using Classic.

Post » Wed Jun 26, 2013 2:40 pm

I have multiple instances of the same object (2-4 players), and I want them to push each other away when they collide ..so I want to know which one of them is on the right side and which one is one the left side from each other when they overlap...

I tried to do it like this: (I'd use the 'Direction' value later in the pushing event)

+ Sprite overlaps Sprite
+ Sprite: X Less Than Sprite.X
- Sprite: Set value 'Direction' to 1

+ Sprite overlaps Sprite
+ Sprite: X Greater Than Sprite.X
- Sprite: Set value 'Direction' to -1

but I guess construct doesn't know I want to compare the X of the two different instances that overlap like that..

tldr: how do I correctly compare the X of Sprite(1) from Sprite(2) ?
(1) meaning instance1 and (2) meaning instance2 of same sprite

Thanks beforehand!
Salevits2013-06-27 09:03:10
B
5
S
2
G
3
Posts: 5
Reputation: 2,112

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests