GMS 2 Need help preventing enemies from getting stuck on eachother

rostd

Member
I am using the built-in grid pathfinding for my enemies to be able to move around walls to chase the player and all that and its working fine but for some reason, if the enemies touch each other they get stuck. I have tried putting move_bounce_solid(other); into a collision with another enemy event but the enemies still get stuck on each other and do not bounce. I also tried this solution
Code:
var push = 1;
x -= lengthdir_x(push,point_direction(x,y,other.x,other.y));
y-= lengthdir_y(push,point_direction(x,y,other.x,other.y));
that many others said would work in another forum post, but once again it didn't help. The enemies still just stuck to each other and stopped moving upon collision.

Here is all the code that I think would be relevant to my problem:

Create Event:
GML:
dmg = 10;
hp = 25;
spd = 5;
alive = true;
depth = 101;
grid = mp_grid_create(0,0,room_width/64,room_height/64,64,64);
path = path_add();
mp_grid_add_instances(path,oWall,0);
mp_grid_add_instances(path,oWallDouble,0);
mp_grid_add_instances(path,oWallCornerFull,0);
mp_grid_add_instances(path,oWallEdge,0);
mp_grid_add_instances(path,oWallFull,0);
mp_grid_add_instances(path,oWallCorner,0);
mp_grid_add_instances(path,oWallBlank,0);
Step event:
Code:
mp_grid_path(grid,path,x,y,oplayer.x,oplayer.y,1);
path_start(path,spd,path_action_reverse,1);
Again I'm trying to make it so that the enemies bounce off each other instead of getting stuck on each other.

Game is top down

I ended up fixing the problem, for anyone else having the same problem just make sure the enemies aren't set as solid.
 
Top