You need to catch the positions. I assume your objects inherits from 2DNode.
[code]
func checkDist(node1, node2):
var a=Vector2( node1.get_pos() - node2.get_pos() )
return sqrt( (a.x a.x) + (a.y a.y) )
You can call this function like this: checkDist( get_node("Player"), get_node("Enemy") )
maybe it could be faster (for the computer) to get the nodes on "_ready" time if your function will be called many times.
onready var player=get_node("Player")
onready var enemy=get_node("Enemy")
#and the call
checkDist(player, enemy)
[/code]
If you want the distance from the current node :
[code]
func distanceTo(targetNode):
var a=Vector2( targetNode.get_pos() - get_pos() )
return sqrt( (a.x a.x) + (a.y a.y) )
[/code]
I haven't tested that but the syntax seems correct to me.