How do I check sprite overlap with itself for each sprite

0 favourites
  • 6 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • I've been trying to figure this out for a while now...

    I have a layout full of instances of the same sprite.

    I'd like to go through each instance and check if it overlaps with another instance of itself.

    Then do a set of actions with pick instance 0 / instance 1.

    My problem is:

    • If I limit the SOL to make sure i've checked each instance; the subsequent overlap check won't work because SOL will contain only one object.
    • If I use overlap for all; pick instance 0 and pick instance 1 will not work except for the first two instances.

    How do I combine these two? Or am i going about this the wrong way?


  • Create a family with this sprite and use it to refer to another instance of the sprite in the same event.


    For each Sprite

    ...Sprite overlapping SpriteFamily

    ........SpriteFamily Set Invisible

    ........Sprite Set Visible

  • dop2000 holy **** it works!

    Also do you think there is any way to solve this without using families?

    I'm just asking because the solution seems like a workaround to the problem and if there is any other way it could work I'd like to know; to better understand this stuff.

    Thanks again!

  • Yes, it's a workaround, but it's a legit workaround

    I think I saw it in one of the official tutorials.

    I guess you can do the same with a function. If sprites are overlapping, call a function, pass sprite UID as a parameter. Inside the function pick all sprites with UID<>param(0), check overlapping again and... not sure what's next. I remember doing something like this, but I don't remember how

    The method with the family is much easier.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I image you'd have the same problem with functions as the first problem I had. You can't get the id of the 2nd instance if you stop using families (when checking all instances).

    Anyways thanks for the help!

    Also, your game looks really nice!

  • No worries!

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