# How can I make an enemy to step around solid objects and follow the player at a given distance?

var target_distance = 40;
var distance_to_object = 0;

target_distance = distance_to_object(objPlayerParent);

if ( target_distance >= follow_distance )
{
mp_potential_step_object(objPlayerParent.x, objPlayerParent.y, 1, objEnemyParent);
}


With this code, the enemy ships are chasing the player, but are still colliding with each other, they also rather fly around the player than following his trail.

mp_potential_step(objPlayerParent.x, objPlayerParent.y, 1, true)


This did not lead to the desired effect either.

How can I make an enemy to step around all solid objects in my level and follow the player at the given distance?

More context: The whole game plays in space and at the moment there are not many objects, but each type of object has it's own parent ( objPlayerParent, objEnemyParent, objPowerUpParent etc) and they are supposed to avoid all objects marked as solid. I also apologize for the quite noobish question but I am really new to advanced AI programming.