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()| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEAD |
static java.lang.String |
IDLE |
static java.lang.String |
WALK |
| 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(). |
protected java.lang.String |
getSpritePrefix() |
addAnimationRule, getDefaultSpritePrefixes, getEntity, isAutoScaling, scaleSprite, scaleSprite, setAutoScaling, setSpritePrefix, updateadd, add, attach, buildCurrentCacheKey, detach, getAffineTransform, getAnimation, getAnimations, getCurrentAnimation, getCurrentSprite, getCurrentSprite, getDefaultAnimation, getImageEffects, hasAnimation, isPlaying, onPlayback, onPlaybackEnded, playAnimation, remove, remove, setAffineTransform, setDefaultAnimationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, add, getAffineTransform, getAnimation, getAnimations, getCurrentAnimation, getCurrentSprite, getCurrentSprite, getDefaultAnimation, getImageEffects, hasAnimation, isPlaying, onPlayback, onPlaybackEnded, playAnimation, remove, remove, setAffineTransform, setDefaultAnimationattach, detachpublic static final java.lang.String IDLE
public static final java.lang.String WALK
public static final java.lang.String DEAD
public CreatureAnimationController(T entity, boolean useFlippedSpritesAsFallback)
public CreatureAnimationController(T entity, Animation defaultAnimation)
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.public Animation flipAnimation(Spritesheet spriteToFlip, java.lang.String newSpriteName)