GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2008-12-19 21:07:44

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

instance_nearest_maxdist

Expand/*
**  Usage:
**      id = instance_nearest_maxdist(x,y,obj,maxdist);
**
**  Arguments:
**      x        x coord
**      y        y coord
**      obj     object to find
**      maxdist, the maximum distance acceptable
**
**  Returns:
**      id       the id of the instance found or noone if none or self is found or if the distance to the instance found is too far
**
**  Notes:
**      like instance_nearest_notme adding distance as a factor
**
**  GMLscripts.com
*/

var xx; xx = x;
x = -10000000
var ret; ret = noone;
with(instance_nearest(argument0,argument1,argument2))
{
    if(id != other.id)
    if(point_distance(x,y,argument0, argument1)<argument3)
    ret = id;
}
x = xx
return ret;

Offline

Board footer

Powered by FluxBB