Class Particle

java.lang.Object
rekit.logic.gameelements.GameElement
rekit.logic.gameelements.particles.Particle
All Implemented Interfaces:
Collidable
Direct Known Subclasses:
DamageParticle, TextParticle

public class Particle extends GameElement
A simple GameElement with no collision and only with graphical effects. Every Particle has a fixed lifeTime after which it removes itself.

Sad life.

Can be given many options as to how to draw the particle and how it changes these options over time.
Author:
Angelo Aracri
  • Field Details

    • currentCol

      protected RGBAColor currentCol
      The current color.
  • Constructor Details

    • Particle

      public Particle()
      Create a particle.
  • Method Details

    • setProperties

      public void setProperties(Polygon polygon, Vec pos, long lifeTime, Progress scale, Progress speed, Progress rotation, Progress angle, Progress colorR, Progress colorG, Progress colorB, Progress colorA)
      Saves all ProgressDependencies required for the Particle behavior.
      Parameters:
      polygon - the shape that the particle should be drawn with
      pos - the initial position of the particle
      lifeTime - the time in millis for how the particle will be rendered
      scale - the ProgressDendency for the polygons size
      speed - the ProgressDendency for the polygons movement speed
      angle - the ProgressDendency for the polygons movement angle
      colorR - the ProgressDendency for the polygons red color channel
      colorG - the ProgressDendency for the polygons green color channel
      colorB - the ProgressDendency for the polygons blue color channel
      colorA - the ProgressDendency for the polygons alpha color channel
      rotation - the ProgressDendency for the polygons rotation
    • logicLoop

      public void logicLoop()
      Description copied from class: GameElement

      Template method that will be called periodically after being added to a IScene.

      Should be overwritten in sub classes for implementing custom logic, physics emulation, time-based actions, ...

      Overrides:
      logicLoop in class GameElement
    • internalRender

      public void internalRender(GameGrid f)
      Description copied from class: GameElement

      Template method that will be called periodically after being added to a IScene. Must be as performant as possible to keep the FPS low, since it will be called in every render-loop.

      Should be overwritten in sub classes for custom visualization using the GameGrid.

      Overrides:
      internalRender in class GameElement
      Parameters:
      f - the GameGrid that represents the games field and supplies primitive drawing operations.
    • capColor

      public int capColor(float col)
      Caps a color to make sure it is never smaller than 0 or greater than 255.
      Parameters:
      col - the color value to cap
      Returns:
      the capped color
    • create

      public Particle create()
      Create a particle.
      Returns:
      a new particle