Picking different instance of different objects.. Issues

Get help using Construct 2

Post » Fri Jan 29, 2016 4:07 pm

Lets say there is object A. And object B. Object A is 'set location'ed to object B when ever their local variables (lets say x and y) are equal.

"http://" imgur.com/mDslt6Z

I got it to run perfectly when there is only one instance of Object A but multiple of Object B.
Eg:
Object B
x=1
y=1
Object B
x=2
y=2
Object A
x=2
y=2

But does't work correctly when there are multiple instances of both objects :(

Object B
x=1
y=1
Object B
x=2
y=2
Object A
x=2
y=2
Object A
x=1
y=1

all instances of object A gets 'locationed' on the same object B even thought hey have different instance variables. The instance are created during run time and the numbers of instances each object is not constant.

I know why. Because the object first chosen for comparison will be the object whose instance will be remembered to be used further in the event. But I just can't seem to find any solution to this. Tried like 10 work arounds, such as comparing the same variables twice, once starting with Object A and then B but nothing works. :(

Pre thanks
B
9
S
2
Posts: 16
Reputation: 570

Post » Fri Jan 29, 2016 6:30 pm

You want to loop through one of the objects and for each one, select the matching other object.

For each object A
Object B variable = object A variable
-->set location
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,620

Post » Sat Jan 30, 2016 4:22 am

If works!! thank you :)
B
9
S
2
Posts: 16
Reputation: 570


Return to How do I....?

Who is online

Users browsing this forum: ksiads and 3 guests