Class EntityEmitter

All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, IEntity, IRenderable, ITimeToLive, IUpdateable, Tweenable, EventListener

public class EntityEmitter extends Emitter
A standard implementation for emitters that are bound to IEntity.getLocation().
See Also:
  • Constructor Details

    • EntityEmitter

      public EntityEmitter(IEntity entity, String emitterResourceName, boolean dynamicLocation)
      Constructs a new EntityEmitter from a given emitter resource that follows an entity's location.
      Parameters:
      entity - The IEntity to which this emitter is bound.
      emitterResourceName - The name of the configuration for this emitter. If the Emitter has been added to the game resource file, it is loaded from there by name. Otherwise, the EmitterLoader will search the Resource folders for a file with the emitterResourceName.
      dynamicLocation - If true, the emitter follows the entity's location; if false, it remains at the location where it has been created.
    • EntityEmitter

      public EntityEmitter(IEntity entity, String emitterResourceName)
      Constructs a new EntityEmitter from a given emitter resource that remains at the location where it has been created.
      Parameters:
      entity - The IEntity to which this emitter is bound.
      emitterResourceName - The name of the configuration for this emitter. If the Emitter has been added to the game resource file, it is loaded from there by name. Otherwise, the EmitterLoader will search the Resource folders for a file with the emitterResourceName.
    • EntityEmitter

      public EntityEmitter(IEntity entity, EmitterData emitterData, boolean dynamicLocation)
      Constructs a new EntityEmitter with EmitterData that follows an entity's location.
      Parameters:
      entity - The IEntity to which this emitter is bound.
      emitterData - The EmitterData object defining the emitter's behavior.
      dynamicLocation - If true, the emitter follows the entity's location; if false, it remains at the location where it has been created.
    • EntityEmitter

      public EntityEmitter(IEntity entity, EmitterData emitterData)
      Constructs a new EntityEmitter with EmitterData that remains at the location where it has been created.
      Parameters:
      entity - The IEntity to which this emitter is bound.
      emitterData - The EmitterData object defining the emitter's behavior.
    • EntityEmitter

      public EntityEmitter(IEntity entity)
      Instantiates a new entity emitter that remains at the location where it has been created.
      Parameters:
      entity - The IEntity to which this emitter is bound.
    • EntityEmitter

      public EntityEmitter(IEntity entity, boolean dynamicLocation)
      Instantiates a new entity emitter.
      Parameters:
      entity - The IEntity to which this emitter is bound.
      dynamicLocation - If true, the emitter follows the entity's location; if false, it remains at the location where it has been created.
  • Method Details

    • getEntity

      public IEntity getEntity()
      Get the IEntity to which this emitter is bound.
      Returns:
      The IEntity to which this emitter is bound.
    • hasDynamicLocation

      public boolean hasDynamicLocation()
      Check if the emitter has dynamic location tracking enabled. This determines whether this Emitter's location is updated along its entity's location.
      Returns:
      True if dynamic location is enabled, false otherwise.
    • setDynamicLocation

      public void setDynamicLocation(boolean dynamicLocation)
      Toggle dynamic location updates.
      Parameters:
      dynamicLocation - If true, the emitter follows its entity's location; if false, it remains at the location where it has been created.
    • getWidth

      public double getWidth()
      Specified by:
      getWidth in interface IEntity
      Overrides:
      getWidth in class Entity
    • getHeight

      public double getHeight()
      Specified by:
      getHeight in interface IEntity
      Overrides:
      getHeight in class Entity
    • getX

      public double getX()
      Specified by:
      getX in interface IEntity
      Overrides:
      getX in class Entity
    • getY

      public double getY()
      Specified by:
      getY in interface IEntity
      Overrides:
      getY in class Entity
    • getLocation

      public Point2D getLocation()
      Specified by:
      getLocation in interface IEntity
      Overrides:
      getLocation in class Entity