如果骨骼动画精灵上存在具有给定名称的自定义附件,此函数将返回。
skeleton_attachment_exists(name);
参数 | 类型 | 描述 |
---|---|---|
name | String | 附件的名称 |
if skeleton_attachment_exists("LegAttachment")
{
skeleton_attachment_replace("LegAttachment", spr_leg_modified, 0, 0, 0, 1, 1, 0);
}
else
{
skeleton_attachment_create("LegAttachment", spr_leg, 0, 0, 0, 1, 1, 0);
}
上述代码首先使用 skeleton_attachment_exists 检查当前骨骼动画精灵上是否存在名为 "LegAttachment" 的附件。如果是,则使用替换 skeleton_attachment_replace。如果没有 skeleton_attachment_create 调用以创建名为"LegAttachment"的新附件。