Collission with or distance

0 favourites
  • 3 posts
  • When I use:

    Player collision with object -> Destroy

    It all works fine and the object is destroyed and only the object in collision with player.

    But I want to use Distance(x1, y1, x2, y2) instead of collission with round objects to use the CPU less.

    My problem is that Distance(Player.x, Player.y, object.x, object.y) -> Destroy, destroys all similar objects when true, and not just the one in "colission".

    So my question is - how do I do so it's only the one in "colission" that is destroyed and not all similar objects on the layout?

    And also - does the distance expression use less CPU power than "colission with" polygons?. I have many collisions in my game, so even a few % optimization is deffinately worth the effort.

  • Hmm... I think the only way to make this method work is to use a "For Each" qualifier, so Construct checks for each object individually. The only problem there is I've found For Each loops to be fairly draining on CPU, so it may not be worth the effort. Someone more experienced than me may have a more valuable opinion, but that's what I've found.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use a sub event to "pick nearest" when distance is below your threshold, then destroy that one it filters out.

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