java.lang.Object
de.gurkenlabs.litiengine.graphics.emitters.particles.Particle
All Implemented Interfaces:
ITimeToLive
Direct Known Subclasses:
ShapeParticle, SpriteParticle, TextParticle

public abstract class Particle extends Object implements ITimeToLive
  • Constructor Details

    • Particle

      public Particle(float width, float height)
      Constructs a new particle.
      Parameters:
      width - the particle width in pixels
      height - the particle height in pixels
  • Method Details

    • getAliveTime

      public long getAliveTime()
      Description copied from interface: ITimeToLive
      Gets the time this instance is alive.
      Specified by:
      getAliveTime in interface ITimeToLive
      Returns:
      Returns how long this instance is alive.
    • getBoundingBox

      public Rectangle2D getBoundingBox(Point2D origin)
      Gets the current bounding box of the particle, depending on its spawn location.
      Parameters:
      origin - the spawn location of this particle
      Returns:
      The Rectangular particle bounding box.
    • getCollisionType

      public Collision getCollisionType()
    • getColor

      public Color getColor()
    • getDeltaHeight

      public float getDeltaHeight()
    • getDeltaWidth

      public float getDeltaWidth()
    • getVelocityX

      public float getVelocityX()
    • getVelocityY

      public float getVelocityY()
    • getAccelerationX

      public float getAccelerationX()
    • getAccelerationY

      public float getAccelerationY()
    • getAngle

      public float getAngle()
    • getDeltaAngle

      public float getDeltaAngle()
    • getHeight

      public float getHeight()
    • isOutlineOnly

      public boolean isOutlineOnly()
    • isAntiAliased

      public boolean isAntiAliased()
    • getOpacity

      public float getOpacity()
    • getRenderLocation

      public Point2D getRenderLocation(Point2D effectLocation)
      Gets the location relative to the specified effect location.
      Parameters:
      effectLocation - the effect position
      Returns:
      the location
    • getCustomRenderType

      public RenderType getCustomRenderType()
    • 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.
    • getWidth

      public float getWidth()
    • getX

      public float getX()
    • getY

      public float getY()
    • isFading

      public boolean isFading()
    • isFadingOnCollision

      public boolean isFadingOnCollision()
    • isContinuousCollisionEnabled

      public boolean isContinuousCollisionEnabled()
    • isStoppingOnCollision

      public boolean isStoppingOnCollision()
    • render

      public abstract void render(Graphics2D g, Point2D emitterOrigin)
    • setCollisionType

      public Particle setCollisionType(Collision collisionType)
    • setContinuousCollision

      public Particle setContinuousCollision(boolean ccd)
      Enabling this check can be very performance hungry and should be used with caution and only for a small amount of particles.
      Parameters:
      ccd - If set to true, the collision will be checked continuously by a ray-cast approximation.
      Returns:
      This particle instance.
    • setStopOnCollision

      public Particle setStopOnCollision(boolean stopOnCollision)
    • setColor

      public Particle setColor(Color color)
    • setDeltaHeight

      public Particle setDeltaHeight(float deltaHeight)
    • setAccelerationX

      public Particle setAccelerationX(float accelerationX)
    • setAccelerationY

      public Particle setAccelerationY(float accelerationY)
    • setAngle

      public Particle setAngle(float angle)
    • setDeltaAngle

      public Particle setDeltaAngle(float deltaAngle)
    • setDeltaWidth

      public Particle setDeltaWidth(float deltaWidth)
    • setVelocityX

      public Particle setVelocityX(float velocityX)
    • setVelocityY

      public Particle setVelocityY(float velocityY)
    • setFade

      public Particle setFade(boolean fade)
    • setFadeOnCollision

      public Particle setFadeOnCollision(boolean fadeOnCollision)
    • setHeight

      public Particle setHeight(float height)
    • setOutlineOnly

      public Particle setOutlineOnly(boolean outlineOnly)
    • setAntiAliasing

      public Particle setAntiAliasing(boolean antiAliasing)
    • setCustomRenderType

      public Particle setCustomRenderType(RenderType renderType)
    • setWidth

      public Particle setWidth(float width)
    • setX

      public Particle setX(float x)
    • setY

      public Particle setY(float y)
    • setTimeToLive

      public Particle setTimeToLive(int ttl)
    • init

      public Particle init(EmitterData data)
    • timeToLiveReached

      public boolean timeToLiveReached()
      Description copied from interface: ITimeToLive
      Determines whether this instance has exceeded its time to live.
      Specified by:
      timeToLiveReached in interface ITimeToLive
      Returns:
      True if the time to live was reached; otherwise false.
    • update

      public void update(Point2D emitterOrigin, float updateRatio)
      Updates the effect's position, change in xCurrent, change in yCurrent, remaining lifetime, and color.
      Parameters:
      emitterOrigin - The current Emitter origin
      updateRatio - The update ratio for this particle.
    • hasRayCastCollision

      protected boolean hasRayCastCollision(Point2D emitterOrigin, float updateRatio)
      Test for ray cast collisions
      Parameters:
      emitterOrigin - The current Emitter origin
      updateRatio - The update ratio for this particle.
      Returns:
      True if ray cast collision occurs
    • getAbsoluteLocation

      public Point2D getAbsoluteLocation(Point2D effectLocation)
    • getAbsoluteX

      protected float getAbsoluteX(Point2D emitterOrigin)
    • getAbsoluteY

      protected float getAbsoluteY(Point2D emitterOrigin)
    • usesCustomRenderType

      public boolean usesCustomRenderType()