Class Particle
java.lang.Object
de.gurkenlabs.litiengine.graphics.emitters.particles.Particle
- All Implemented Interfaces:
ITimeToLive
- Direct Known Subclasses:
ShapeParticle,SpriteParticle,TextParticle
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedParticle(float width, float height) Constructs a new particle. -
Method Summary
Modifier and TypeMethodDescriptiongetAbsoluteLocation(Point2D effectLocation) protected floatgetAbsoluteX(Point2D emitterOrigin) protected floatgetAbsoluteY(Point2D emitterOrigin) floatfloatlongGets the time this instance is alive.floatgetAngle()getBoundingBox(Point2D origin) Gets the current bounding box of the particle, depending on its spawn location.getColor()floatfloatfloatfloatfloatfloatgetRenderLocation(Point2D effectLocation) Gets the location relative to the specified effect location.intGets the total time to live of this instance.floatfloatfloatgetWidth()floatgetX()floatgetY()protected booleanhasRayCastCollision(Point2D emitterOrigin, float updateRatio) Test for ray cast collisionsinit(EmitterData data) booleanbooleanbooleanisFading()booleanbooleanbooleanabstract voidrender(Graphics2D g, Point2D emitterOrigin) setAccelerationX(float accelerationX) setAccelerationY(float accelerationY) setAngle(float angle) setAntiAliasing(boolean antiAliasing) setCollisionType(Collision collisionType) 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.setCustomRenderType(RenderType renderType) setDeltaAngle(float deltaAngle) setDeltaHeight(float deltaHeight) setDeltaWidth(float deltaWidth) setFade(boolean fade) setFadeOnCollision(boolean fadeOnCollision) setHeight(float height) setOutlineOnly(boolean outlineOnly) setOutlineThickness(float outlineThickness) setStopOnCollision(boolean stopOnCollision) setTimeToLive(int ttl) setVelocityX(float velocityX) setVelocityY(float velocityY) setWidth(float width) setX(float x) setY(float y) booleanDetermines whether this instance has exceeded its time to live.voidUpdates the effect's position, change in xCurrent, change in yCurrent, remaining lifetime, and color.boolean
-
Constructor Details
-
Particle
protected Particle(float width, float height) Constructs a new particle.- Parameters:
width- the particle width in pixelsheight- the particle height in pixels
-
-
Method Details
-
getAliveTime
public long getAliveTime()Description copied from interface:ITimeToLiveGets the time this instance is alive.- Specified by:
getAliveTimein interfaceITimeToLive- Returns:
- Returns how long this instance is alive.
-
getBoundingBox
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
-
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() -
getOutlineThickness
public float getOutlineThickness() -
isOutlineOnly
public boolean isOutlineOnly() -
isAntiAliased
public boolean isAntiAliased() -
getOpacity
public float getOpacity() -
getRenderLocation
Gets the location relative to the specified effect location.- Parameters:
effectLocation- the effect position- Returns:
- the location
-
getCustomRenderType
-
getTimeToLive
public int getTimeToLive()Description copied from interface:ITimeToLiveGets the total time to live of this instance.- Specified by:
getTimeToLivein interfaceITimeToLive- 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
-
setCollisionType
-
setContinuousCollision
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
-
setColor
-
setDeltaHeight
-
setAccelerationX
-
setAccelerationY
-
setAngle
-
setDeltaAngle
-
setDeltaWidth
-
setVelocityX
-
setVelocityY
-
setFade
-
setFadeOnCollision
-
setHeight
-
setOutlineThickness
-
setOutlineOnly
-
setAntiAliasing
-
setCustomRenderType
-
setWidth
-
setX
-
setY
-
setTimeToLive
-
init
-
timeToLiveReached
public boolean timeToLiveReached()Description copied from interface:ITimeToLiveDetermines whether this instance has exceeded its time to live.- Specified by:
timeToLiveReachedin interfaceITimeToLive- Returns:
- True if the time to live was reached; otherwise false.
-
update
Updates the effect's position, change in xCurrent, change in yCurrent, remaining lifetime, and color.- Parameters:
emitterOrigin- The currentEmitteroriginupdateRatio- The update ratio for this particle.
-
hasRayCastCollision
Test for ray cast collisions- Parameters:
emitterOrigin- The currentEmitteroriginupdateRatio- The update ratio for this particle.- Returns:
- True if ray cast collision occurs
-
getAbsoluteLocation
-
getAbsoluteX
-
getAbsoluteY
-
usesCustomRenderType
public boolean usesCustomRenderType()
-