I will be giving the answer assuming that your sprites were designed this way (with the front side up):
The origin of sprites is middle center and bottom center, respectively.
obj_Enemy - Create Event:
obj_Enemy - Step Event:
- -90 is for the values to match. It may vary according to the way your sprites were designed.
obj_Cone - Draw Event:
- 20 was a value that I stipulated as suitable for my tests, it may be the value that you want in your game.
obj_Cone - Collision with Player Event:
direction=point_direction(x,y,obj_Player.x,obj_Player.y); //For the enemy to turn to the player
rest of your code
At range/distance you can use the following code in the enemy's step event:
But if you prefer you can do something like this, for different distances:
See above, that there are 3 different cones, with green being the smallest and red being the largest. That is, there would be 3 cone objects. You would do the same process for everyone.
For the player not to notice this, they just need to be the same color.