Move enemy toward closest sprite

Get help using Construct 2

Post » Fri Jun 14, 2013 1:41 am

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
B
8
S
2
G
2
Posts: 11
Reputation: 1,756

Post » Fri Jun 14, 2013 1:20 pm

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.
B
8
S
2
G
2
Posts: 11
Reputation: 1,756


Return to How do I....?

Who is online

Users browsing this forum: loz666, Mogador, Sumyjkl and 1 guest