Picking different instance of different objects.. Issues

0 favourites
  • 3 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • 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

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If works!! thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)