check instance variable of object being overlapped

  • Hi,

    Newbie here. Had a search through the forums and trying to find if there is a solution for the below. Thanks for the help

    I am dragndropping one object1 over another stationary object2. When the 2 objects overlap I want to check the instance variable of the object2 and make a change to the instance variable of object1. Is this possible? I can only seem to check instance variable of object1, the one being moved.

  • Are object1 and object2 really different objects? Or are they two instances (copies) of the same object?

    With two different objects there should be no problem accessing their instance variables in the same event.

    If they are two instances of the same object, then there is a trick you can use -

    say you have a sprite Circle. Create a family CircleFamily with just this sprite.

    Then change your event to this:

    Circle overlapping CircleFamily ...

    Inside this event you will be able to access both instances that are overlapping - one using "Circle" name and another using "CircleFamily".

  • Thanks dop2000,

    The two objects are 2 instances of the same object.

    I need to do this multiple times so assume creating a family each time would be counter productive for this particular case. Any other ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this:

    If you are dragging instance A and it overlaps instance B, event #3 will pick instance B. Event #4 will pick instance A.

  • Thanks dop2000, that got me on the right path for what I need to do.

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