instance_furthest

Returns the id of the instance of an object furthest from a given position.

Syntax:

instance_furthest(x, y, obj);


Argument Description
x The x position to check for instances far from.
y The y position to check for instances far from.
obj The object to check for instances of.


Returns: Real


Description

This function will check all the instances of the given object to see which is furthest from the given point of origin. If no instances of the object exist, the function will return the keyword noone, but if there are instances then it will return the id of the instance found. Please note that if the instance running the code was created as an instance of the object being checked, then it will be included in the check.


Example:

var inst;
inst = instance_furthest(x, y, object_index);
if inst != id
   {
   draw_line(x, y, inst.x, inst.y);
   }

The above code will find the furthest instance that shares the same object index as the instance running the code and store the id in a variable. This variable is then checked to see if it is the same as the id of the calling instance and, if it is not, a line is drawn between the two instances.


Back: Instance Functions
Next: instance_nearest
© Copyright YoYo Games Ltd. 2018 All Rights Reserved