Pick nearest command help

  • 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:

    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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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