# How do I create 8-directions collision?

Get help using Construct 2

### » Tue Nov 01, 2016 5:46 pm

I am creating a top down zombie shooter and I am currently programming the zombies, but I ran into a problem. The zombies tend to stack up when chasing the player, giving the imprecation that there are less zombies than there really are. The zombies AI uses a combination of path-finding and 8-directions. I would like the zombies to sort of repel each other (similar to Minecraft http://static.planetminecraft.com/files ... 177659.jpg).
I have tried making the zombies have the Solid behavior but that leads to very glitchy behavior (Like zombies pushing the player thru walls). If anybody can help please respond. Thank You
B
22
S
3
Posts: 67
Reputation: 1,157

### » Tue Nov 01, 2016 7:27 pm

The most realistic way is using boids algorithm. There is an example for that in forum. Alternatively simple hack would do the trick: how-do-i-set-drag-bounds-for-a-sprite_t122964?&hilit=block&start=10
B
123
S
53
G
24
Posts: 794
Reputation: 23,942

### » Thu Feb 23, 2017 1:33 am

alextro wrote:The most realistic way is using boids algorithm. There is an example for that in forum. Alternatively simple hack would do the trick: how-do-i-set-drag-bounds-for-a-sprite_t122964?&hilit=block&start=10

I love the example CAPX you showed. It is exactly what I was looking for! Except for one problem. The code you provided does not work with instances of the same object. If you know a way to make this work with instances of the same object, I would be thrilled!

PS I tried using Boids flocking algorithm. But it did not produce the type of behavior that I wanted.

PPS Sorry for the response being so late.
B
22
S
3
Posts: 67
Reputation: 1,157

### » Thu Feb 23, 2017 2:11 am

B
123
S
53
G
24
Posts: 794
Reputation: 23,942