soundgnome Then it seems I'm having trouble with the actual iteration. I'm getting a Invalid get index 'position' (on base 'Node') error on this line of code:
indexglobalposition = targetsfound[i].position
the surrounding code looks like this
for i in container.get_child_count():
targetsfound.append(container.get_child(i))
for i in range(0, targetsfound.size()):
indexglobalposition = targetsfound[i].position
indexdistance = selfglobalposition.distance_to(indexglobalposition) #need to fix
if distancetobeat == null :
distancetobeat = indexdistance
closesttarget = targetsfound[i]
else :
if indexdistance < distancetobeat :
distancetobeat = indexdistance
closesttarget = targetsfound[i]