Enemies and Turning

So I have been working on a game and I just started to add in enemies for the player to kill. The problem is the enemies don’t know to turn when they get to an edge like a pitfall or lava pit. Is there anyway to make them turn when they get to an edge. I can’t figure out how to do it with collisions because they aren’t hitting anything.

Add timer(repeat forever) … when the timer finish the enemy turns the other way

make an object that is invisable and make it non-solid, when it colides with it, toggle a flip

the con is that this allows a player to jump in mid air