How do I prevent enemies overlap each other using pathfinder

Get help using Construct 2

Post » Wed Sep 09, 2015 6:50 pm

My enemies have the pathfinder behavior. It's working now, but they are passing over each other. So I set the obstacles as custom and then added them as obstacles on start of layout. However, it's not working and It keeps avoiding walls (solids) but not themselves.

Would love some help here =/
Thanks.

edit: I know that I need to use regenerate obstacles action to update themselves as obstacles since they are moving, but then it starts to get really slow because its cpu intensive. How should I do? There are another way to make enemy's AI without pathfinder behavior?
Last edited by kossglobal on Thu Sep 10, 2015 2:00 am, edited 2 times in total.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Sep 09, 2015 7:13 pm

Are the enemies Solids?
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Post » Wed Sep 09, 2015 7:24 pm

The best workaround is avoid the overlapping by using a checking overlapping procedure.

It's simple, just make a condition "every tick" and "Enemy" is overlapping "Enemy Family", if so, then do an action "go to the opposite side" (you can do this last action by checking the angle of the overlapped enemy and adding 180 degrees in his direction of movement).
Image
B
104
S
23
G
17
Posts: 1,350
Reputation: 22,028

Post » Wed Sep 09, 2015 7:25 pm

You could always do something custom. If they bump into each other, make them stop, shake their heads, take a step back, and find a new path :) You could even pick a random number to see what they do. Like if randomNumber = 1 they shake heads, step back, find a new path, if 2 they stand there looking like they're complaining to each other, 3 = they shake their fists at each other...

Just some random examples, not sure what you're making though.
B
7
S
2
Posts: 92
Reputation: 663

Post » Wed Sep 09, 2015 7:43 pm

Well, I'd like to use pathfinder to solve this, but It seems that there are no way to make this without the high cpu cost

Nice options, guys. I'll try them and see if it works.

Thanks!
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Sep 09, 2015 9:11 pm

Well, none of these solutions worked that well =/. I tried regenerating just around those who is overlapping themselves but it doesnt work too.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Sep 09, 2015 9:25 pm

@TELLES0808

I'm still trying to do it, but they got stuck and sometimes they go in the same direction when they have the same angle. Could you please make an example in capx for me?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Thu Sep 17, 2015 11:26 pm

Monday I'll take a time to make it for you =]
Image
B
104
S
23
G
17
Posts: 1,350
Reputation: 22,028

Post » Fri Sep 18, 2015 9:49 pm

TELLES0808 wrote:Monday I'll take a time to make it for you =]


It's working ok now but thanks! :)
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Sep 23, 2015 4:29 pm

TELLES0808 wrote:Monday I'll take a time to make it for you =]



I'll take the example that's what I'm looking for...

Thanks
Check out my latest game RAPID-TAPIT. Get your Fingercise on with this one. A steady Tap is all you need to score points. Lift a finger and see what you can do...

Image

ALLMarkMade Designs
B
32
S
15
G
3
Posts: 356
Reputation: 5,269

Next

Return to How do I....?

Who is online

Users browsing this forum: jasontoups and 3 guests