Collision_rectangle - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
Notation
Description
Returns the id any instance of obj that collides with the specified rectangle. Returns noone if no collision occurs.
Parameters
- x1,y1: The top-left coordinates of the rectangle in the room.
- x2,y2: The bottom-right coordinates.
- obj: Object to check if inside rectangle.
- prec: Precise collision checking. (True=use it. False=not to use it.)
- notme: If the object that calls the function should be included in the collision (true) or not (false).
Return Values
int: Returns who the collision occured with.
Example Call
// The following example checks if the object "obj_enemy" is inside the specified rectangle, then executes the code.
if (collision_rectangle(0,0,624,64,obj_enemy,0,1) != noone) // Check if an enemy has penetrated our rectangle
{
--lives; // Decrease lives
room_restart(); // Restart the room
}
NOTOC