How do I pick "closest" object?

0 favourites
  • 4 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • I did some googling and couldn't find anything. I'm a huge fan of figuring things out on my own, but unfortunately I've been thinking about this for quite some time and can't figure it out.

    I want to pick within the conditions an object that is closest to another object.

    For example, I have automatic fighter ships that fly around and shoot stuff with limited ammo. When the Ammo is depleted, they are sent to the command center to replenish. This works fine.

    However, when there are two command centers for them, I'd rather make them a bit smarter. I want each individual ammo-depleted fighter to decide which command center is closest to them and pick it. The actions are taken care of. I just can't figure out how to make a unit Pick an object based on distance.

  • Use event from your fighter under "Size and Position": Pick nearest/furthest

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Was it that simple, jeez. No wonder why nothing came up in my searches, it's not even a problem.

    Thanks a lot! Here I am trying to come up with a math problem to use in the Pick by Comparison...

  • I am all about simple

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