If it's a side scrolling platformer then you use line of sight combined with platform simulate left/right based on if the enemy x is greater or less than the player. Or enemies could be bullets where you set the angle to 0 or 180 when they have line of sight. There's lots of ways to do it, you didn't give much information about your game though.