Move enemy toward closest sprite

0 favourites
  • 2 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • Hello everyone,

    I'm having trouble figuring out how to do this particular task.

    I have a series of sprites that are spaced out in a scrolling game.

    These sprites represent things the player must pick up.

    There are monsters also on the ground where these pick up items are.

    I want to have these monsters move toward the closest pick up item.

    The view is a 2d view, platform style, not top down.

    I know there is a set angle toward another object, but when I use that the sprite tilts toward the target, which isn't ideal.

    I've also not quite figured out how to determine which is closer.

    I did try adding the platform behavior to my monsters so I can use its actions...

    Thanks for any assistance,

    Dower

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just to add more info to what I've been finding so far.

    I think I'm on the right track... I was able to put a for each loop into the events for the enemy to loop through every instance of my pickup items, and use the distance function to at least find out which is closest. Now to figure out how to make it move toward it.

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