sprite_get_bbox_top

This function returns the relative position of the top of the sprite bounding box. This value is given as a relative value based on the upper left corner of the base sprite asset being (0,0). it is the same value as can be found in the sprite editor for the collision mask properties. The image below shows how it is calculated:

BBox Example

 

Syntax:

sprite_get_bbox_top(ind);

ArgumentTypeDescription
indSprite AssetThe index of the sprite to check.

 

Returns

Real

 

Example:

var ww, hh;
ww = sprite_get_bbox_left(sprite_index) - sprite_get_bbox_right(sprite_index);
hh = sprite_get_bbox_bottom(sprite_index) - sprite_get_bbox_top(sprite_index);

The above code calculates the width and height of the collision mask based on the relative bounding box side positions.