it is somewhat complicated to do this. first, is it a platformer? top-down? what is the movement type you are using?
There are a few tutorials that go over AI. You need to constantly tell your enemy to move in a certain direction, then change if they get to an obstacle. Depending on your game you could use PathFinding behavior and mix that with the Turret behavior.