In this example the enemy will follow you if you are near his proximity and will start wandering if you're out of his proximity
Arrow Keys To Move.
This example uses some top down enemy movement code from other games to show this example.