java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.graphics.emitters.Emitter
All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, IEntity, IRenderable, ITimeToLive, IUpdateable, Tweenable, EventListener
Direct Known Subclasses:
EntityEmitter

public class Emitter extends Entity implements IUpdateable, ITimeToLive, IRenderable
A standard implementation for emitters that provide a particle effect.
  • Constructor Details

    • Emitter

      public Emitter()
    • Emitter

      public Emitter(EmitterData emitterData)
    • Emitter

      public Emitter(Point2D origin, EmitterData emitterData)
    • Emitter

      public Emitter(double x, double y, EmitterData emitterData)
    • Emitter

      public Emitter(double x, double y, String emitterXml)
    • Emitter

      public Emitter(Point2D origin, String emitterXml)
    • Emitter

      public Emitter(double originX, double originY)
    • Emitter

      public Emitter(Point2D origin)
  • Method Details

    • activate

      public void activate()
    • addParticle

      public void addParticle(Particle particle)
      Adds a particle to this Emitter's list of Particles.
      Parameters:
      particle - the particle
    • deactivate

      public void deactivate()
    • delete

      public void delete()
    • getAliveTime

      public long getAliveTime()
      Gets the alive time.
      Specified by:
      getAliveTime in interface ITimeToLive
      Returns:
      the alive time
    • data

      public EmitterData data()
    • getOrigin

      public Point2D getOrigin()
    • updateOrigin

      protected void updateOrigin()
    • getRenderable

      public IRenderable getRenderable(RenderType type)
    • getParticles

      public List<Particle> getParticles()
      Gets the particles.
      Returns:
      the particles
    • isActivateOnInit

      public boolean isActivateOnInit()
    • isActivated

      public boolean isActivated()
    • isFinished

      public boolean isFinished()
      Checks if the emitter duration is reached.
      Returns:
      true, if the emitter is finished
    • isPaused

      public boolean isPaused()
      Checks if is paused.
      Returns:
      true, if is paused
    • setPaused

      public void setPaused(boolean paused)
      Sets the paused.
      Parameters:
      paused - the new paused
    • isStopped

      public boolean isStopped()
    • setStopped

      public void setStopped(boolean stopped)
    • onFinished

      public void onFinished(Emitter.EmitterFinishedListener listener)
    • removeFinishedListener

      public void removeFinishedListener(Emitter.EmitterFinishedListener listener)
    • render

      public void render(Graphics2D g)
      Description copied from interface: IRenderable
      Renders the visual contents of this instance onto the provided graphics context.

      If an Entity implements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.

      This interface can be implemented in general by anything that should be rendered to the game's screen.

      Specified by:
      render in interface IRenderable
      Parameters:
      g - The current graphics object onto which this instance will render its visual contents.
      See Also:
    • setEmitterData

      public void setEmitterData(EmitterData emitterData)
    • setEmitterData

      public void setEmitterData(String emitterXmlPath)
    • timeToLiveReached

      public boolean timeToLiveReached()
      Time to live reached.
      Specified by:
      timeToLiveReached in interface ITimeToLive
      Returns:
      true, if successful
    • togglePaused

      public void togglePaused()
    • toggleStopped

      public void toggleStopped()
    • getTimeToLive

      public int getTimeToLive()
      Description copied from interface: ITimeToLive
      Gets the total time to live of this instance.
      Specified by:
      getTimeToLive in interface ITimeToLive
      Returns:
      The total time to live.
    • update

      public void update()
      Description copied from interface: IUpdateable
      This method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using the ClientConfiguration.
      Specified by:
      update in interface IUpdateable
      See Also:
    • canTakeNewParticles

      protected boolean canTakeNewParticles()
      Can take new particles.
      Returns:
      Whether-or-not the effect can hold any more particles.
    • createNewParticle

      protected Particle createNewParticle()
      Creates the new particle.
      Returns:
      the particle
    • particleCanBeRemoved

      protected boolean particleCanBeRemoved(Particle particle)
      Particle can be removed.
      Parameters:
      particle - the particle
      Returns:
      true, if successful
    • spawnParticle

      protected void spawnParticle()