If you want an enemy to follow you, give the enemy an instance variable like var_walking. Then in your events you can set up something like this:
Set the variable:
if enemy has line of sight to player
if enemy.x < player.x+1 -> set var_walking 0
if enemy.x > player.x -> set var_walking 1
Make the event happen:
if var_walking = 0 -> simulate control left
if var_walking = 1 -> simulate control right
You can also just do walking with the same variable and events if you don't want the enemy to follow the player. Something like this should work set up when the enemy doesn't have line of sight:
On collision with obstacle -> set enemy var_walking to 1-enemy.var_walking
I hope that makes sense.