Pick nearest command help

Get help using Construct 2

Post » Sun Jun 02, 2013 3:23 am

I am creating a tower defense game where the enemies shoot back at the turrets. I have spent multiple hours and tried multiple setups of code and none will perform the desired task. I have used the "pick nearest" command to target a box, and the box is always fixed on a turret. However, when the turret is destroyed (along with the box), the enemies fire at the second placed turret instead of the next CLOSEST turret. I can't find where I'm going wrong. If anyone has the time to look at this and lend advice I'd greatly appreciate it.

The specific lines of code are at the bottom of the L1-1 Event Sheet.

Here is the capx:

https://dl.dropboxusercontent.com/u/103925639/CAPx/TDWF.capx

If you run the layout, click the texts on the right to spawn a turret and the other icons are self explanatory.

Thanks to anyone who has the time.
B
6
S
1
Posts: 11
Reputation: 597

Post » Sun Jun 02, 2013 5:57 am

Have you tried making it where your enemies are turrets too? (moving turrets work just like stationary ones.) Use the turret code to do all that for you.
B
230
S
62
G
33
Posts: 902
Reputation: 40,323

Post » Sun Jun 02, 2013 2:01 pm

Paradox, that was the first option I tried, but the enemy will not rotate as a turret and move along a path (while pathfinding) at the same time.
B
6
S
1
Posts: 11
Reputation: 597


Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 44 guests