Move multiple objects towards their nearest enemies

Get help using Construct 2

Post » Tue Apr 05, 2016 8:46 pm

I'm trying to get multiple copies of sprites to move towards enemy sprites that are closest to them.

What I have is:

Event:
If PlayerSprite is not overlapping EnemySprite
Pick nearest EnemySprite to PlayerSprite.X, PlayerSprite.Y

Action:
Set Angle of PlayerSprite to Position of EnemySprite

The problem is that any copy of PlayerSprite will go towards the nearest enemy to the original PlayerSprite instead of the nearest enemy to itself.

I feel like it's a simple fix but I just can't get my head around it right now :roll:

Can anybody help me out?

Thanks
B
8
S
3
Posts: 49
Reputation: 698

Post » Tue Apr 05, 2016 9:20 pm

Add "System - For Each PlayerSprite" in your condition.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Apr 05, 2016 9:30 pm

Ooooh, I see. That makes sense haha.

Thanks a lot :D
B
8
S
3
Posts: 49
Reputation: 698


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot], yiuyiu6666 and 15 guests