I am looking for an ai engine to track the closet sprite to them (for example 2 players).

    'track the closest sprite next to them'?
    wdym

    pluto You don’t want computer learning, right?
    Try using some algebra and stuff to track the distance, and then use If statements with > and <

    to find the direction(angle) between two points:
    var angle = atan2(target.y-subject.y,target.x-subject.x);
    to have the subject move at that angle:
    subject.x += cos(angle)*speed;
    subject.y += sin(angle)*speed;

    stretch the collider into a big circle around the sprite, then anything inside the collider shall be tracked with sprite.istouching
    if there are several sprites in this circle, make a second, smaller circle

      nobody has to know how it works they just play the game

      • -wyi replied to this.

        its kinda a stupid idea tho

        person wait, what if we need it to be a stealth game?
        Do you know how to make it so you have to be in their line of sight?

        • -wyi replied to this.

          -wyi
          I would like to make it work like among us basically, but different in the sense that you’re infiltrating an area, and trying not to get shot. You can see both everything in a radius, and anything in your line of sight.

          • -wyi replied to this.

            -wyi the guards can do the same, other than the radius of view.
            A guard can see you from like, a distance of 8 guards away while you’re moving for up to 15 seconds at a time before they react.

            • -wyi replied to this.

              -wyi anyone know how to help me with this?

                ackvonhuelio Actually you can make multiple sprites and then set the sprites containing the extra colliders to invisble. Then you can merge the main sprite and the extras into a group and you won't have to worry

                -wyi you could make an invisible collider in a very specific shape that would be the "line of sight" and if the player touches the collider, then it will shoot a projectile in your direction

                Chat