"Pick Nearest" of Simultaneous Collisions Not Working

0 favourites
  • 4 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • SET UP

    In order to account for the possibility that my Character, "Buster", will collide with multiple instances of the Enemy at the same time, I want to isolate the closest Enemy in this rare occurrence. The reason for this is because Buster is going to attempt to "possess" the Enemy and so the possession loop is triggered. But he can only (attempt to) possess one Enemy at a time. So I need to make sure the right Enemy is isolated in a manner that makes sense to the player.

    PROBLEM

    The issue I'm having is that the same Enemy is picked when using Pick Nearest condition no matter how close or far away the Enemy is when two instances of Enemies are collided with at the same time.

    ATTEMPT TO SOLVE

    I have tried to isolate the Collision and Pick Nearest conditions per someone else's suggestion in Discord. However, I'm still getting the same problem. Previously, I had Pick Nearest in the same condition line as the Collision check. I don't think the order of the condition checks is the issue, because I need to pick all Enemies that are being collided with and then pick the closest one.

    Ultimately, I'm confused as to why this isn't working. Insight would be appreciated.

  • Looks like "On collision" is triggered separately for each instance.

    You can use "Is overlapping" instead, and "Pick nearest" as a second condition.

    Or try removing "for each" from the code on your screenshot.

  • dop2000 - Thank you. I will try that and get back to you with a yay or nay.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000 Aaaaaand there you have it - a successful edit.

    I was hoping the On Collision trigger would suffice as I needed something that would isolate the events the way I needed it. But it seems this will work just fine.

    THANKS as always!

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