Hello Ozumi,
You can check out this zombie example:
The zombie will approach only when the player is nearby.
www.gamemaker3d.com/player?pid=01641983
Here’s a brief explanation of the code blocks:
• The zombie constantly calculates the distance from the camera (player).
• If the player is within 200 units, the zombie rotates to face the player, moves toward them, and plays the “walk” animation.
• If the player is farther than 200 units, the zombie stays idle and plays the “idle” animation.
Feel free to view the source code for more details.
Best regards,
The Cyberix3D Team