kts.Anim

Name

kts.Anim – create a new Anim

Synopsis

result = kts.Anim(anim_table)

Description

An Anim is a collection of Graphics that represents the complete set of animation frames for a single creature (e.g. a knight, zombie or vampire bat) or for a flying projectile (e.g. an axe).

The anim_table parameter must be an array of either 4, 12, 16 or 32 Graphics. Each Graphic represents one frame of animation.

The best way to understand which graphics must be given (and in which order) is to look at anims.lua to see how the existing animations for knights, vampire bats, zombies and flying projectiles (axes, bolts and daggers) are created.

As well as the list of Graphics, the anim_table can also include bat=true if the animation is for a vampire bat (this is used for the "flapping wings" effect of the bats).

Return Value

The new Anim is returned.

Errors

An error results if the anim_table is not in the expected format, or does not contain the correct number of elements.

Bugs

The documentation for this function could be better.

Anims should also ideally be more flexible – right now, the number of frames of animation (and their meaning) is hard coded for particular use cases (e.g. knights have 32 frames of animation, zombies 16, and so on) – but it would be better if the Lua code could create Anims with an arbitrary number of frames, and control what those frames are used for and when/how they are displayed.

See Also

kts.Graphic