bbox_left

Returns the position of the left hand side of the bounding box.

Syntax:

bbox_left


Returns: Real


Description

This read only variable returns the x position (within the room) of the left hand bounding box for the instance, where the bounding box is defined by the maximum width and height of the mask for the instance (as set by the sprite or by the mask index). Even when a sprite has a precise collision mask, the bounding box exists and is used for certain things, and so you can use this variable to find it. Please note that when the instance has no sprite assigned the bbox_ variables will always return 1.


Example:

if bbox_left < 0
{
x = sprite_xoffset;
}

The above code checks to see if the bounding box of the instance is outside the room and if it is it sets the instance to a new position.


Back: Instance properties
Next: bbox_right
© Copyright YoYo Games Ltd. 2018 All Rights Reserved