How do I see if two members of a sprite family overlap?

0 favourites
  • 4 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hello;

    Box is a family of sprites. I want to write a function that returns a 1 if two specific box.UID values overlap. so it is functions.DoTheseOverlap(boxOne.UID,boxTwo.UID)

    How do I write this?

    If I just say box overlapping box I get a big SOL of all the overlapping boxes, not just these two.

    thanks for your time.

    yours

    winkr7

  • you can make a second family for the purposes of comparing... put all the same sprites in both families.

    then in your function pick the first UID as Box

    the second as Box2

    then you can test if Box is overlapping Box2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In an overlap check, you can use system pick nth instance, where instance 0 and instance 1 are the two objects involved in the overlap check.

    So logic is on overlap, pick Family nth instance 0 and set a variable to family.UID. Alsp pick Family nth instance 1 and set a variable to family.UID. Then you have the UIDs of the 2 objects involved in the collision, you can send them through a function as parameters to check if they are the correct objects.

  • Thanks AllanR and Plinkie. I think I will go with the two family solution.

    I appreciate your time, both of you.

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