public class CreatureAnimationController<T extends Creature> extends EntityAnimationController<T>
AnimationController
implementation provides animation rules that
use naming conventions to provide Animation
s 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
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() |
addAnimationRule, getDefaultSpritePrefixes, getEntity, scaleSprite, scaleSprite, setAutoScaling, setSpritePrefix, update
add, add, addListener, attach, buildCurrentCacheKey, detach, getAffineTransform, getAnimation, getAnimations, getCurrentAnimation, getCurrentSprite, getCurrentSprite, getDefaultAnimation, getImageEffects, hasAnimation, isPlaying, playAnimation, remove, remove, removeListener, setAffineTransform, setDefaultAnimation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, addListener, getAffineTransform, getAnimation, getAnimations, getCurrentAnimation, getCurrentSprite, getCurrentSprite, getDefaultAnimation, getImageEffects, hasAnimation, isPlaying, playAnimation, remove, remove, removeListener, setAffineTransform, setDefaultAnimation
attach, detach
public CreatureAnimationController(T entity, boolean useFlippedSpritesAsFallback)
public CreatureAnimationController(T entity, Animation defaultAnimation)
public boolean isAutoScaling()
isAutoScaling
in interface IEntityAnimationController
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.public static java.lang.String getSpriteName(Creature creature, CreatureAnimationState state)
public static java.lang.String getSpriteName(Creature creature, CreatureAnimationState state, Direction direction)