Class Particle
java.lang.Object
rekit.logic.gameelements.GameElement
rekit.logic.gameelements.particles.Particle
- All Implemented Interfaces:
Collidable
- Direct Known Subclasses:
DamageParticle
,TextParticle
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface rekit.logic.Collidable
Collidable.Optional
-
Field Summary
FieldsFields inherited from class rekit.logic.gameelements.GameElement
deleteMe, deltaTime, team, visible
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
capColor
(float col) Caps a color to make sure it is never smaller than 0 or greater than 255.create()
Create a particle.void
Template method that will be called periodically after being added to aIScene
.void
Template method that will be called periodically after being added to aIScene
.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.Methods inherited from class rekit.logic.gameelements.GameElement
checkCollision, create, destroy, getDeleteMe, getFrame, getPos, getScene, getSize, getTeam, getVel, getZ, getZHint, init, isAddableToGroup, isVisible, killBoost, reactToCollision, render, setPos, setScene, setSize, setVel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface rekit.logic.Collidable
addDamage, collidedWithSolid, getLives
-
Field Details
-
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 withpos
- the initial position of the particlelifeTime
- the time in millis for how the particle will be renderedscale
- the ProgressDendency for the polygons sizespeed
- the ProgressDendency for the polygons movement speedangle
- the ProgressDendency for the polygons movement anglecolorR
- the ProgressDendency for the polygons red color channelcolorG
- the ProgressDendency for the polygons green color channelcolorB
- the ProgressDendency for the polygons blue color channelcolorA
- the ProgressDendency for the polygons alpha color channelrotation
- 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 classGameElement
-
internalRender
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 classGameElement
- Parameters:
f
- theGameGrid
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
Create a particle.- Returns:
- a new particle
-