The "collision_line_meeting" Function
#
SyntaxArgument | Type | Description |
---|---|---|
x1 | real | The X coordinate of the starting point of a line to check |
y1 | real | The Y coordinate of the starting point of a line to check |
x2 | real | The X coordinate of the ending point of a line to check |
y2 | real | The Y coordinate of the ending point of a line to check |
obj | object/instance | The object or instance to check for collisions (or Keyword all for all active instances) |
prec | boolean | Enables or disables checking precise collision masks (if any) |
notme | boolean | Enables or disables excluding other instances of the running object from collision checks |
#
DescriptionFinds the exact point of collision between two sets of coordinates and an input object. Results are returned as a struct containing three keys: the nearest colliding instance id
, plus the x
and y
values of the exact point of collision. If no collision is found, the instance ID will be considered noone
and the position unchanged from x2
and y2
.
The object to check for collisions can be an object ID (in which case all instances of the object will be considered, a single instance ID, or keyword all
for all active instances. Set notme
to true
to exclude instances of the running object from consideration.
Collisions can be evaluated precisely (per-pixel, with a collision mask) or by bounding box, depending on whether prec
is true
or false
. This setting also depends on the type of collision mask defined in the Sprite Editor (i.e. a precise mask must be created for enabling precise collisions to have any effect).