Picking offset sprites

  • Hi all,

    I suspect this is not possible, either that or I have really missed something.

    I have lots of instances of the same sprite, I need to know when another instance of the same sprite is, say, 16 pixels above another (IE Y-16).

    This is easy enough using the 'Is Overlapping At Offset' event, set Y to -16 and I get all the sprites with another sprite 16 pixels above them.

    But is there any way of picking the sprite that is at the Y-16 offset? Using Pick Instance does not work because the picked sprites are only those with a Sprite at Y-16, not the ones at Y-16.

    I realise I can have another event to look for the Y+16 sprites, but it seems really wasteful to have to do two overlap detection's when both sprites would have been found in the first event.

    Any ideas?

    Cheers,

    RR

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Found a solution using Families, here is an example to illustrate:

    https://dl.dropboxusercontent.com/u/15657176/FindBothInOffsetOverlap.capx

    By putting the sprite in a family and then detecting offset overlap with that we get 2 picked lists, one for the sprite and one for the family.

    Using FOR EACH did not work as it only picks from one object.

    Using a normal FOR loop from zero to 'PickedCount' and then applying the Pick Instance event on both the sprite and family seems to get the matching pairs.

    I hope this helps someone else as it was really frustrating me!

    RR.

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