How do I pick "closest" object?

Get help using Construct 2

Post » Sat May 02, 2015 3:14 am

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.
B
7
S
1
Posts: 39
Reputation: 511

Post » Sat May 02, 2015 3:35 am

Use event from your fighter under "Size and Position": Pick nearest/furthest
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331

Post » Sat May 02, 2015 3:40 am

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...
B
7
S
1
Posts: 39
Reputation: 511

Post » Sat May 02, 2015 4:17 am

I am all about simple :)
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
65
S
17
G
8
Posts: 635
Reputation: 9,331


Return to How do I....?

Who is online

Users browsing this forum: Zav and 6 guests