[QUOTE=sqiddster] No, the range is relatively small.
However, this UID and looping is part of what is confusing to me about construct. SO what am I to do? A large invisible circle around the object? I am still a bit confused.[/QUOTE]
Every object has unique ID (UID) in Construct and is used to select a specific object (no two objects have the same UID). Of all the ways to do it you will still have to loop through all objects you want to test the distance to. To optimise this and make it faster you would need to make sure you do the bare minimum with events to each object only focusing on the objects that matter. So:
Use paint or whatever to draw a square say 320x320 pixels in size (or whatever the largest distance is you want to check) fill it pink or whatever (doesn't matter), set this as a new object call it rangeCollisionBox or whatever, set opacity to 80 just so you can see whats through it. Set this objects visibility to "invisible" you don't want to see it when you run the program. Setup the events so that every "tick" the rangeCollisionBox is positioned at the players position or do this every time you want to check the nearest object.
Next, do a "for each" on every object you're checking the distance to then add a sub event underneath this which checks whether the objects are overlapping the rangeCollisionBox. If they are then perform Ashley's algorithm on each of these.
I'm not 100% sure this is right and 100% sure it makes sense as I can't test at the moment. I hope it helps
I'll see if I can knock up a capx tonight.
Edit: If Ashley made the nearest function and it used his method you could still use a collision box to filter the objects.00Rez2011-09-21 11:44:17