此函数可用于设置精灵的边界框模式。您可以提供sprite索引和要使用的模式,它应该是以下常量之一:
边界框模式常量 | |
---|---|
常量 | 描述 |
bboxmode_automatic | Automatic - The bounding box will be calculated automatically, based on the tolerance setting for the sprite |
bboxmode_fullimage | Full Image - The bounding box will be set to use the full width and height of the sprite, regardless of the tolerance and "empty" pixels |
bboxmode_manual | Manual - The bounding box is being set manually to user defined values, which requires the use of the function sprite_set_bbox() |
注意此函数影响sprite资源,以便此精灵的所有其他实例将具有相同的边界框模式。
sprite_set_bbox_mode(ind, mode);
参数 | 类型 | 描述 |
---|---|---|
ind | Sprite Asset | 要更改模式的精灵的索引。 |
mode | 边界框模式常量 | 设置(常数)的模式。 |
N/A
if (sprite_get_bbox_mode(sprite_index) != bboxmode_automatic)
{
sprite_set_bbox_mode(sprite_index, bboxmode_automatic);
}
上面的代码检查当前精灵的bbox模式,如果它不是自动,则将其设置为该值。