Table of Contents

Inheriting Animations using Prefixes

This is an advanced tutorial in order to explain how to reuse existing Animations, but using Prefixes to give meaningful names to the new animations, while being able to make minimal changes to the the new animation.

If you don't know how to use the Animation System, visit this guide first: Animation Walk-through

A Standard Animation

Consider the following example:

[BonusAnimSet]
Texture     = bonus.png
FrameSize   = (16, 16)
Pivot       = center
KeyDuration = 0.1
StartAnim = Loop
Loop = 8
Destroy = 8
Loop-> = Loop # .!Destroy
Destroy-> =
 
[Loop1]
KeyDuration = 3
 
[Destroy]
BlendMode = add

We can now set the KeyDuration for the first frame of Loop as well as the BlendMode for the whole Destroy animation and it'll get carried away even for animation sets based on this one using a prefix, such as the following:

An Inherited Animation

[BonusBombAnimSet@BonusAnimSet]
Prefix = BonusBomb

[BonusBombLoop]
TextureOrigin = (0, 16)

[BonusBombDestroy]
TextureOrigin = (128, 16)

By setting Prefix = BonusBomb, properties like BonusBombLoop will refer to the inherited Loop property.

And now. where we simply override the TextureOrigin for both animation BonusBombLoop and BonusBombDestroy but we'll inherit the KeyDuration and BlendMode that we previously set in Loop and Destroy.

This takes a few minutes to get the hang off, but it is amazingly powerful.