Class Prop

All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, ICollisionEntity, ICombatEntity, IEntity, Tweenable, EventListener

public class Prop extends CombatEntity
A static/destructible scenery entity rendered from a sprite. Props extend CombatEntity so they can take damage and be destroyed, and support optional shadow rendering, sprite flipping/rotation and quality-based scaling.
  • Constructor Details

    • Prop

      public Prop(String spritesheetName)
      Instantiates a new Prop entity.
      Parameters:
      spritesheetName - The spritesheet name of this prop.
    • Prop

      public Prop(double x, double y, String spritesheetName)
      Instantiates a new Prop entity.
      Parameters:
      x - The x-coordinate of this prop.
      y - The y-coordinate of this prop.
      spritesheetName - The spritesheet name of this prop.
    • Prop

      public Prop(double x, double y, String spritesheetName, Material material)
      Instantiates a new Prop entity.
      Parameters:
      x - The x-coordinate of this prop.
      y - The y-coordinate of this prop.
      spritesheetName - The spritesheet name of this prop.
      material - The material of this prop.
    • Prop

      public Prop(Point2D location, String spritesheetName)
      Instantiates a new Prop entity.
      Parameters:
      location - The location of this prop.
      spritesheetName - The spritesheet name of this prop.
    • Prop

      public Prop(Point2D location, String spritesheetName, Material material)
      Instantiates a new Prop entity.
      Parameters:
      location - The location of this prop.
      spritesheetName - The spritesheet name of this prop.
      material - The material of this prop.
  • Method Details

    • getMaterial

      public Material getMaterial()
      Gets the material of this prop.
      Returns:
      the material
    • getSpritesheetName

      public String getSpritesheetName()
      Gets the name of the spritesheet used to render this prop.
      Returns:
      the spritesheet name
    • getState

      public PropState getState()
      Gets the state.
      Returns:
      the state
    • isAddShadow

      public boolean isAddShadow()
      Returns whether this prop should cast a shadow.
      Returns:
      true if a shadow is rendered
    • isScaling

      public boolean isScaling()
      Returns whether this prop's sprite is scaled to its bounding box.
      Returns:
      true if scaling is enabled
    • flipHorizontally

      public boolean flipHorizontally()
      Returns whether this prop's sprite is flipped horizontally.
      Returns:
      true if flipped horizontally
    • flipVertically

      public boolean flipVertically()
      Returns whether this prop's sprite is flipped vertically.
      Returns:
      true if flipped vertically
    • getSpriteRotation

      public Rotation getSpriteRotation()
      Gets the sprite rotation applied to this prop.
      Returns:
      the sprite rotation
    • setMaterial

      public void setMaterial(Material material)
      Sets the material of this prop.
      Parameters:
      material - the material to set
    • setSpritesheetName

      public void setSpritesheetName(String spriteName)
      Sets the name of the spritesheet used to render this prop and updates the animation controller.
      Parameters:
      spriteName - the new spritesheet name
    • setAddShadow

      public void setAddShadow(boolean addShadow)
      Sets whether this prop should cast a shadow.
      Parameters:
      addShadow - true to render a shadow
    • setScaling

      public void setScaling(boolean scaling)
      Sets whether this prop's sprite should be scaled to its bounding box.
      Parameters:
      scaling - true to enable scaling
    • isDead

      public boolean isDead()
      Description copied from class: CombatEntity
      Checks if is dead.
      Specified by:
      isDead in interface ICombatEntity
      Overrides:
      isDead in class CombatEntity
      Returns:
      true, if is dead
    • setSpriteRotation

      public void setSpriteRotation(Rotation spriteRotation)
      Sets the sprite rotation applied to this prop.
      Parameters:
      spriteRotation - the rotation to set
    • setFlipHorizontally

      public void setFlipHorizontally(boolean flipHorizontally)
      Sets whether this prop's sprite is flipped horizontally.
      Parameters:
      flipHorizontally - true to flip horizontally
    • setFlipVertically

      public void setFlipVertically(boolean flipVertically)
      Sets whether this prop's sprite is flipped vertically.
      Parameters:
      flipVertically - true to flip vertically
    • toString

      public String toString()
      Overrides:
      toString in class Entity
    • createAnimationController

      protected IEntityAnimationController<?> createAnimationController()
      Creates the animation controller used to render this prop. Subclasses may override this method to provide a custom controller implementation.
      Returns:
      the new animation controller