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);

ArgumentType Description
pxReal The x coordinate of the point to check.
pyReal The y coordinate of the point to check.
x1Real The x coordinate of the circle centre.
y1Real The y coordinate of the circle centre.
radReal The 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.