Class AnimatedEntity
java.lang.Object
model.Entity
model.AnimatedEntity
- All Implemented Interfaces:
EventListener,EntityEventListener
- Direct Known Subclasses:
AlienEntity,ShotEntity
Adds infrastructure to give the entity animation through a provided list of
sprites when the entity is in the ALIVE state
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected static final doubleThe speed of animation in milliseconds per imageThe sprites to use in animationprotected intprotected intprotected doubleFields inherited from class model.Entity
canMoveDown, canMoveLeft, canMoveRight, canMoveUp, currentState, DEF_REF_TO_SPRITE_IMAGE_FILE, DEF_X, DEF_Y, DEFAULT_DEATH_RATE, dx, dy, dyingSpritesList, justEnteredState, LIFE_LEFT_TOLERANCE, lifeLeft, sound, sprite, x, y -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSetters and GettersvoidsetAnimated(boolean value) setAnimated sets alien animation statusvoidsetAnimationSpritesList(List<String> animationSpritesList) voidupdateState(long delta) Request that this entity updates its state based on a certain amount of time (in milliseconds) passing.Methods inherited from class model.Entity
addEntityEventListener, collidesWith, collisionArea, collisionHasOccured, draw, entityDied, entityMoved, equals, fireCollisionHasOccured, fireEntityDied, fireEntityMoved, getCurrentState, getDyingSpritesList, getHorizontalMovement, getLifeLeft, getSound, getSprite, getVerticalMovement, getX, getY, hashCode, move, moveTo, removeEntityEventListener, setCurrentState, setDyingSpritesList, setHorizontalMovement, setLifeLeft, setSound, setSprite, setVerticalMovement, toString
-
Field Details
-
ANIMATION_SPEED
protected static final double ANIMATION_SPEEDThe speed of animation in milliseconds per image- See Also:
-
animated
protected boolean animated -
currentMoveSprite
protected int currentMoveSprite -
currentSprite
protected int currentSprite -
millisLastRotated
protected double millisLastRotated -
animationSpritesList
-
-
Constructor Details
-
AnimatedEntity
-
-
Method Details
-
getAnimationSpritesList
-
setAnimationSpritesList
-
setAnimated
public void setAnimated(boolean value) setAnimated sets alien animation status -
updateState
public void updateState(long delta) Description copied from class:EntityRequest that this entity updates its state based on a certain amount of time (in milliseconds) passing. The current state will be used to determine what changes in data are needed (eg sprite, lifeleft etc)- Overrides:
updateStatein classEntity- Parameters:
delta- The amount of time that has passed in milliseconds
-