collision_line(x1,y1,x2,y2,obj,prec,notme)

From ENIGMA
Jump to navigation Jump to search

Description

General description of the function.

Parameters

Parameter Description
x1 x coordinate of the first point of the line
y1 y coordinate of the first point
x2 x coordinate of the second point of the line
y2 y coordinate of the second point
obj object type index, to check the collision of all instances of the object
prec whether to use precise perpixel collision checking
notme whether or not the object calling the function should be checked for collision with the line

Return Values

inst_t: Returns the ID of the first object detected to be colliding with the line, or the special ID noone if there are no such instances.

Example Call

// demonstrates checking for a collision between two objects for another object
if (collision_line(obj_player.x, obj_player.y, obj_enemy.x, obj_enemy.y, obj_wall, false, false) != noone) {
  // there was a collision with a wall between the player's position and the enemy's 
} else {
  // there was no collision
}