Stopping enemies bumping into each other

Get help using Construct 2

Post » Sat Nov 15, 2014 4:51 pm

I have multiple instances (enemies) spawning every 5 seconds which when close enough to player rotate towards player to attack. But if player stays still then all the enemies "pile" on top of each other. How can I do it so that if the enemies are within a certain distance from each other, they move away from each other to stop "bumping" into each other.
The enemies is a single sprite with 19 different frames, so that every 5 seconds a random frame/random enemy is created.

Thanks.
B
28
S
6
G
2
Posts: 86
Reputation: 3,267

Post » Sat Nov 15, 2014 5:57 pm

I didn't try, but maybe use the pathfinding and solid behaviors on the enemies ?
pathfinding.png
You do not have the required permissions to view the files attached to this post.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sat Nov 15, 2014 6:18 pm

I have got enemies set to solid and solid behaviour properties set to Bounce off solids, but it doesn't look pretty when they collide.
B
28
S
6
G
2
Posts: 86
Reputation: 3,267

Post » Sat Nov 15, 2014 6:40 pm

I like using families so you can pick two instances of the same type. Then it's just a matter of comparing the distances. If too close, push apart.
You do not have the required permissions to view the files attached to this post.
B
91
S
31
G
103
Posts: 5,241
Reputation: 67,768

Post » Sat Nov 15, 2014 6:54 pm

@R0J0hound

Perfect, thanks for that. Just what I was looking for. Thank you
B
28
S
6
G
2
Posts: 86
Reputation: 3,267

Post » Sun Nov 16, 2014 9:42 am

Nice !
B
12
S
7
G
7
Posts: 450
Reputation: 4,276


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests