kureoni
Member
thats the basic movement code for the obj_enemies
what i want to do is:
when the obj_enemies touch a obj_colision (that includes other enemies, walls etc)
the obj will be repelled a few pixels to the oposite side it is looking at
i did that with the player movement script to prevent that:
and it works perfectly, i just dont know how to do that on the mobs
help??
(the enemies image_angle follows the player position, so right now when the enemies turn around they are going inside walls and getting stuck etc)
GML:
if(instance_exists(obj_player)){
mp_potential_step(obj_player.x, obj_player.y, spd, obj_colision)
image_angle = point_direction(x, y, obj_player.x, obj_player.y);
when the obj_enemies touch a obj_colision (that includes other enemies, walls etc)
the obj will be repelled a few pixels to the oposite side it is looking at
i did that with the player movement script to prevent that:
GML:
if (move_right && !place_meeting(x+spd,y, obj_colision)){
x+=spd;
}
if (move_down && !place_meeting(x, y+spd, obj_colision)){
y+=spd;
}
if (move_up && !place_meeting(x, y-spd, obj_colision)){
y-=spd;
}
if (move_left && place_meeting(x-spd,y, obj_colision)){
x+=spd;
}
if (move_right && place_meeting(x+spd,y, obj_colision)){
x-=spd;
}
if (move_down && place_meeting(x, y+spd, obj_colision)){
y-=spd;
}
if (move_up && place_meeting(x, y-spd, obj_colision)){
y+=spd;
}
help??
(the enemies image_angle follows the player position, so right now when the enemies turn around they are going inside walls and getting stuck etc)