Collision_line - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

Notation

Description

General description of the function.

Parameters

  • x1: (x1,y1) first point of the line
  • y1
  • x2: (x2,y2) second point of the line
  • y2
  • 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

bool: Returns (true or false) whether or not there is a collision.

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
}

NOTOC