public class CreatureAnimationController<T extends Creature> extends EntityAnimationController<T>
AnimationController implementation provides animation rules that
use naming conventions to provide Animations for Creature
implementations.
The spritesheet images need to be named according to the following
conventions in order to be automatically used by this controller:
getSpritePrefix()-idle-{DIRECTION}.{EXTENSION}getSpritePrefix()-walk-{DIRECTION}.{EXTENSION}Direction enum and
getSpritePrefix() refers to the current sprite prefix of the entity.
{EXTENSION} refers to a value of the
ImageFormat enum.Creature,
Direction,
IEntity.getName()EntityAnimationController.AnimationRule<T extends IEntity>| Constructor and Description |
|---|
CreatureAnimationController(T entity,
Animation defaultAnimation) |
CreatureAnimationController(T entity,
boolean useFlippedSpritesAsFallback) |
CreatureAnimationController(T entity,
boolean useFlippedSpritesAsFallback,
Animation defaultAnimation,
Animation... animations) |
| Modifier and Type | Method and Description |
|---|---|
Animation |
flipAnimation(Spritesheet spriteToFlip,
java.lang.String newSpriteName) |
protected java.lang.String |
getCurrentAnimationName()
This method evaluates the current animation name that depends on certain
properties of the
EntityAnimationController.getEntity(). |
static java.lang.String |
getSpriteName(Creature creature,
CreatureAnimationState state) |
static java.lang.String |
getSpriteName(Creature creature,
CreatureAnimationState state,
Direction direction) |
protected java.lang.String |
getSpritePrefix() |
boolean |
isAutoScaling() |
addRule, addRule, getDefaultSpritePrefixes, getEntity, scaleSprite, scaleSprite, setAutoScaling, setSpritePrefix, updateadd, add, addListener, attach, buildCurrentCacheKey, clear, detach, get, getAffineTransform, getAll, getCurrent, getCurrentSprite, getCurrentSprite, getDefault, getImageEffects, hasAnimation, isEnabled, isPlaying, play, remove, remove, removeListener, setAffineTransform, setDefault, setEnabledclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, add, addListener, clear, get, getAffineTransform, getAll, getCurrent, getCurrentSprite, getCurrentSprite, getDefault, getImageEffects, hasAnimation, isEnabled, isPlaying, play, remove, remove, removeListener, setAffineTransform, setDefault, setEnabledattach, detachpublic CreatureAnimationController(T entity, boolean useFlippedSpritesAsFallback)
public CreatureAnimationController(T entity, Animation defaultAnimation)
public static java.lang.String getSpriteName(Creature creature, CreatureAnimationState state)
public static java.lang.String getSpriteName(Creature creature, CreatureAnimationState state, Direction direction)
public boolean isAutoScaling()
isAutoScaling in interface IEntityAnimationController<T extends Creature>isAutoScaling in class EntityAnimationController<T extends Creature>public Animation flipAnimation(Spritesheet spriteToFlip, java.lang.String newSpriteName)
protected java.lang.String getSpritePrefix()
getSpritePrefix in class EntityAnimationController<T extends Creature>protected java.lang.String getCurrentAnimationName()
EntityAnimationController.getEntity(). Overwriting this method allows to
specify more sophisticated animations.