sprite_get_bbox_right

此函数用于返回精灵边框右侧的相对位置。该值是基于基础精灵资源左上角的相对值(0,0)给出的。它与在精灵编辑器中找到的值相同。对于碰撞遮罩属性。下图显示了它的计算方法:

BBox Example

语法:

sprite_get_bbox_right(ind);

参数类型描述
indSprite Asset要检查的精灵的索引。

 

返回

Real

 

例子:

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

上面的代码基于相对的边界框侧位置计算碰撞遮罩的宽度和高度。