Selecting from two objects based on distance

This forum is currently in read-only mode.
From the Asset Store
Footsteps SFX Two contains 450 sounds of steps and jumps on different surfaces.
  • Ok, so here's what I'm trying to do.

    I have two of the same sprite, (ally) and an enemy sprite (enemy).

    The enemy sprite has line of sight and RTS movement.

    I want to get the enemy to choose the ally that is closer.

    The ally has a family (good) that the enemy is looking for.

    What is happening is that the enemy sprite always goes to one ally.

    Even if the other ally is closer.

    It seems like the enemy is choosing the ally with the higher "priority," always.

    How can I fix this?

    (Get the enemy to choose the closer ally to move to)

    I think it has to do with which ally I'm telling it to go to.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a distance between two points event under math, which is under system which will help. Give the allies a private variable that is set to the distance between them and the enemy, and have the enemy pick the lowest one.

  • I ended up doing something different, but you pointed me in the right direction.

    Thanks for the help!

  • there is also a pick closest condition for sprites

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