Making other enemies back off when one is near player

Get help using Construct 2

Post » Thu Jul 10, 2014 6:22 pm

Could someone direct me to a tutorial or a forum post that might explain how to make all other enemies in a level stop moving towards the player and wait once one is near the player? I assume it has to do with the system selecting the closest instance of an enemy and then turning off any chase-type behavior on all the others, but it would help if I could see an example to learn from.

Thanks in advance!
B
4
Posts: 37
Reputation: 276

Post » Thu Jul 10, 2014 6:59 pm

If you're unable to use families, then, you should pick the ID or UID of the enemy with the desired distance and check it against other enemies, every enemy with the ID different of that pick should back off.

But I prefer to simplify it using a mask around the player, when it touch an enemy, trigger a condition to set your needs.
Image
B
108
S
24
G
18
Posts: 1,372
Reputation: 22,817

Post » Thu Jul 10, 2014 9:46 pm

Thanks for replying. I will probably purchase Construct once I've made sure that everything I want to be able to do in my game is possible, so I'll be able to use Families then.

In my game, an enemy does collide with a hidden player object when in range, so I guess I just need to trigger a condition that all other enemies of the same type (or in the same Family) will move at least a certain number of pixels away? Again, an example would help a lot, but I understand what you're saying. Much appreciated. :)
B
4
Posts: 37
Reputation: 276

Post » Fri Jul 11, 2014 7:55 am

Is this any good? Looks like the technique that @TELLES0808 described.
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Jul 11, 2014 10:29 pm

That's interesting, will definitely try to implement it a little later when I have more time. Thank you sharing!
B
4
Posts: 37
Reputation: 276

Post » Fri Jul 11, 2014 10:31 pm

creating a family will help
B
7
S
1
Posts: 57
Reputation: 484

Post » Fri Jul 11, 2014 11:44 pm

@caplocks1111 How? That's really not helpful, at least take the time to elaborate your answer.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, Iakkery and 30 guests