Create an object and select a sprite for your enemy.
Create a Step event and add the code to the left. Replace "obj_character" with whatever you have named the main character object.
This code checks to see if the player is less than 300 pixels from the character. If so, it uses simple AI to move towards the player's X and Y coordinates at a speed of 1 pixel per frame. (If the game runs at 60 frames per seconds, that's 60 pixels a second)
If the player is not within 300 pixels (else), the enemy moves back towards its starting point.
To get the enemy to avoid obstacles (rather than floating through them) you must select each obstacle's object (walls, trees, etc.) and select the Solid option. This ensures that the mp_potential_step code used for the AI knows which objects to avoid when planning the enemy's movement.