## animate

### Syntax:

    animate (character, animation);

### Purpose:

Makes the specified character perform the selected animation which must be created with the anim function. The character will continue performing the animation until told to move, change direction or speak.

The animate function can be used, for example, to provide different speaking animations without having to build a new costume.

    animate (ego, chinHitsFloorAnimation);
    think (ego, "WHAT?");
    say (ego, "Are you kidding?");

The above example will give the ego character a different animation while it thinks the line "WHAT?" - the ego will then use its standard talking animation to say the like "Are you kidding?".

### Return value:

The return value is the total playing time of animation. Consequently, the following code will perform an animation once and once only:

    var a = anim ('pickNose.duc', 0, wait (1, 4), 2, 3, 4);
    pause (animate (ego, a));
    normalCharacter (ego);

In the above example, the return value of the animate function is 8... 1 + 4 + 1 + 1 + 1. So, the pause function stops the function for 8 frames: just long enough for the animation to run.

### See also:

addCharacter

normalCharacter

SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012