Well, i will try to explain how to do.
Firstly we need to learn that we are approaching the enemy.
I think we can do this with:
const MINIMUM_DISTANCE = 300 # minimum 300 pixel
onready var enemyNode = $EnemyNode # enemy node
onready var myNode = $MyNode # our node
func _process(delta):
if enemyNode.global_position.x - myNode.global_position.x < MINIMUM_DISTANCE:
_on_area_entered():
func _on_area_entered():
#do somethings
i hope this will be helpfull for you.