```
/// @function collision_line_first(x1,y1,x2,y2,object,prec,notme)
/// @param {real} x1 first X value on collision line, real
/// @param {real} y1 first Y value on collision line, real
/// @param {real} x2 second X value on collision line, real
/// @param {real} y2 second Y value on collision line, real
/// @param {real} object which objects to look for (or all), real
/// @param {real} prec if true, use precise collision checking, bool
/// @param {real} notme if true, ignore the calling instance, bool
/// @description Returns the instance id of an object colliding with a given line and
/// closest to the first point as well as the x/y position of the collision,
/// or noone if no instance found.
/// The solution is found in log2(range) collision checks.
function collision_line_first(x1,y1,x2,y2,object,prec,notme)
{
var sx, sy, inst, i;
sx = x2 - x1;
sy = y2 - y1;
inst = collision_line(x1, y1, x2, y2, object, prec, notme);
if (inst != noone)
{
while ((abs(sx) >= 1) || (abs(sy) >= 1))
{
sx /= 2;
sy /= 2;
i = collision_line(x1, y1, x2, y2, object, prec, notme);
if (i)
{
x2 -= sx;
y2 -= sy;
inst = i;
}
else
{
x2 += sx;
y2 += sy;
}
}
}
var _a = array_create(3);
_a[0] = inst;
_a[1] = y2;
_a[2] = x2;
return _a;
}
```