How do I pick an object that has another object nearby?

  • I've been scratching my head for a while now and i cant figure out how to do this.

    I want to pick every object on screen that has another object within a certain distance. Whenever objects get clumped together i want to change some attributes.

    Pick by comparison: distance(block.X,block.Y,Family1.X,Family1.Y) < 120

    didnt work at all.

    Any ideas?

  • What are you up to? Boids ? Or something else? A picture will help people to understand the case.

  • Maybe using another object as area of collision?

  • What are you up to? Boids ? Or something else? A picture will help people to understand the case.

    Im trying to optimize my Z Ordering routine to use less CPU for mobile, so I only want to sort objects that are nearby or overlapping. I don't want to create a lot of dummy sprites to limit the sorting to the ones that are overlapping, so i figured i would use distance instead. So what i need to do is to pick every sprite that is near another sprite, because theres no point to sort sprites that are not overlapping in any way.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why not just use the "is overlapping" condition, if that is the only thing you are interested in?

  • Because the collision boxes are not set at the outer limits of the sprites, it would be awesome if there was a way to check for any colliding BBbox instead.

  • just an idea, have you tried, "for each block" pick by comparison...

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