Here is an example that shows how to get a sprite to wander around a tile-map maze endlessly. (without getting stuck)
The turn conditions are the collision offsets. When it gets to a horizontal wall it chooses a vertical angle. When it comes to a vertical wall it changes to a horizontal angle.
[attachment=0:2kamlbqu][/attachment:2kamlbqu]
hope it comes in useful for someone