Class AnimatedEntity

java.lang.Object
model.Entity
model.AnimatedEntity
All Implemented Interfaces:
EventListener, EntityEventListener
Direct Known Subclasses:
AlienEntity, ShotEntity

public abstract class AnimatedEntity extends Entity
Adds infrastructure to give the entity animation through a provided list of sprites when the entity is in the ALIVE state
  • Field Details

    • ANIMATION_SPEED

      protected static final double ANIMATION_SPEED
      The 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

      protected List<String> animationSpritesList
      The sprites to use in animation
  • Constructor Details

    • AnimatedEntity

      public AnimatedEntity(String ref, int x, int y)
  • Method Details

    • getAnimationSpritesList

      public List<String> getAnimationSpritesList()
      Setters and Getters
    • setAnimationSpritesList

      public void setAnimationSpritesList(List<String> animationSpritesList)
    • setAnimated

      public void setAnimated(boolean value)
      setAnimated sets alien animation status
    • updateState

      public void updateState(long delta)
      Description copied from class: Entity
      Request 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:
      updateState in class Entity
      Parameters:
      delta - The amount of time that has passed in milliseconds