Pick nearest command help

0 favourites
  • 3 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.
  • 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:


    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.

  • Try Construct 3

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

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

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