You can use this formula
distance(object1.x,object1.y,object2.x,object2.y)
That returns the distance between object1 and object2 which you of course change to the name of the objects in your game
But you can use line of sight behaviour or a "is overlapping at offset" condition to see if the player is in distance as well. It is easier and might be better.