I am creating an infection simulator for my CS Class and need help on getting the distance of a clone. What I am currently doing is checking if the distance to my other clones is less than a certain value. the problem here is if every clone is in the radius it activates the script that runs when the clone is close. I am storing the clones in a list for easy changes of the clone. I am looking for a way to check for the closest clone without checking all clones in the radius. Also I need a way to access the object of the clone for the list.
Edit: Another thing Im looking for is an easy index reporter
I tested ti out and it works, though you need to know the item number of a clone in the my [clones v] block. Here's a project showcaseing this I also included an item # of block in the project.
Hi!
Brian's answer is the easiest way to escape from checking all your clones: use "my neighbors".
Then, depending the total number of clones and the number of neighbors (you will have there all their near sprites, including their own clones) you can reduce your list using:
or
To pick your closest clone, multiple options... you can use the "sort" block (from the list utilities library). Then, closest clone is: