How to check the position of the point of collision in an area2D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LyguN

Im trying to make an enemy attack system where the enemy launches at the player with a tween if the player walks in the attackzone, which is an area2D. The problem I’m having is that when the attack is initiated, and if we say for the sake of the argument that the player walks to the other side of the map, the enemy will launch at him all the way over there. Is it possible to instead make it so that the enemy will launch at the point in the attackzone where the player entered?

Here is that piece of script:

if attackDetector.get_overlapping_areas():
	 attacking = true
	 velocity = Vector2.ZERO
else:
	 timer.stop()

if attacking == true and tween.is_active() == false and timer.time_left > 0:
	attacking = true
	animSprite.play("Enemy_Prepare")
	yield(animSprite,"animation_finished")
	timer.stop()
	tween.start()
	tween.interpolate_property(self, "position", self.position, player.position, 1, tween.TRANS_EXPO, tween.EASE_IN_OUT)
	animSprite.play("Enemy_Attack")
	yield(tween, "tween_completed")
	tween.set_active(false)
	attacking = false
:bust_in_silhouette: Reply From: aadyainfotainment

If you are using Area2d to detect the player entering the enemy zone. You can use the signal

func _on_Area2D_body_entered(body):
print(body.get_position())