Collision line: Difference between revisions

From ENIGMA
Jump to navigation Jump to search
(→‎Example Call: general cleanup using AWB)
Line 23: Line 23:


== Return Values ==
== Return Values ==
'''boolean''': Returns whether or not there is a collision.
'''inst_t''': Returns the ID of the first object detected to be colliding with the line, or the special ID <code>noone</code> if there are no such instances.


== Example Call ==
== Example Call ==

Revision as of 09:28, 19 June 2013

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
}