skeleton_attachment_replace_colour

This function replaces an existing custom attachment on the current instance's skeletal animation sprite with another one. It also sets the blend colour to use when drawing this attachment.

The change to the attachment will be visible in all Slots that have the attachment assigned.

 

Syntax:

skeleton_attachment_replace_colour(name, sprite, ind, xorigin, yorigin, xscale, yscale, rot, colour, alpha);

ArgumentTypeDescription
nameStringThe name of the attachment to replace
spriteSprite AssetThe index of the sprite asset to use for the attachment
indRealThe image_index of the sprite to use
xoriginRealThe x origin to use for the image. The sprite's origin is ignored.
yoriginRealThe y origin to use for the image. The sprite's origin is ignored.
xscaleRealThe horizontal scale factor of the image
yscaleRealThe vertical scale factor of the image
rotRealThe rotation of the image. This is added to the bone's rotation.
colourColourThe blend colour to use when drawing the sprite
alphaRealThe alpha value to use when drawing the sprite

 

Returns:

Real (1 if successful, -1 if not)

 

Example:

if (skeleton_attachment_exists("fruit_attachment"))
{
    skeleton_attachment_replace_colour("fruit_attachment", spr_apple, 0, 0, 0, 1, 1, 0, c_lime, 1);
}

The above code first checks if an attachment with the name "fruit_attachment" exists on the skeleton. If it does, it replaces the attachment image with a sprite "spr_apple", with no change in offset, rotation or scale and a  colour of c_lime and alpha value of 1.