When using own.hit Object List how do you print out the chosen item. I mean how do you go thought the list with the python system. Is it print(own.hit Object List[0],[10]) or something like that?......., and then receive a print out . I could use the info. i need for the a.i to chose the farthest object and track_to it trying to use Near sensor.
1 Answer
$\begingroup$
$\endgroup$
You can do it this way.
from bge import logic
if logic.getCurrentController.sensors['Near'].positive:
for obj in controller.sensors['Near'].hitObjectList:
print(obj)