point_in_circle

When using this function, you define a circular area and GameMaker will work out whether the given point falls within its bounds or not. If the point falls within the defined circle the function will return true otherwise the function will return false.

 

Syntax:

point_in_circle(px, py, x1, y1, rad);

ArgumentTypeDescription
pxRealThe x coordinate of the point to check.
pyRealThe y coordinate of the point to check.
x1RealThe x coordinate of the circle centre.
y1RealThe y coordinate of the circle centre.
radRealThe radius of the circle.

 

Returns:

Boolean

 

Example:

if (point_in_circle(mouse_x, mouse_y, x, y, 16))
{
    over = true;
}
else
{
    over = false;
}

The above code uses the point_in_circle function to check if the mouse position falls within the defined circular area, setting the variable "over" to true if it does, or false otherwise.