org.jrabbit.standard.game.objects.particles.generic
Class GenericParticle

java.lang.Object
  extended by org.jrabbit.standard.game.objects.base.Spatial
      extended by org.jrabbit.standard.game.objects.base.BaseSprite
          extended by org.jrabbit.standard.game.objects.particles.base.Particle
              extended by org.jrabbit.standard.game.objects.particles.generic.GenericParticle
All Implemented Interfaces:
Renderable, Updateable, Skin, GLTransform, Colored, Dimensioned, GLGroupTransformed, Located, Rotated, Scaled, ScreenObject, Visible
Direct Known Subclasses:
SprayParticle

public class GenericParticle
extends Particle

A GenericParticle is a particle along the lines of most particle systems; it has a velocity and acceleration , rotation rate, scaling rate, and fade rate. It is destroyed when either its scaling or its transparency reaches 0.

Author:
Chris Molini

Field Summary
protected  Vector2f acceleration
          The particle's acceleration.
protected  float fadeRate
          The rate at which the particle fades out of existence.
protected  float scaleRate
          The particle's scaling rate.
protected  float spinRate
          The particle's rate of rotation.
protected  Vector2f velocity
          The particle's velocity.
 
Fields inherited from class org.jrabbit.standard.game.objects.particles.base.Particle
parent, skinID
 
Fields inherited from class org.jrabbit.standard.game.objects.base.BaseSprite
color, screenCoords, transforms, visible
 
Fields inherited from class org.jrabbit.standard.game.objects.base.Spatial
location, rotation, scalar
 
Constructor Summary
GenericParticle(float vX, float vY, float aX, float aY, float scaleRate, float spinRate, float lifetime)
          Creates a generic particle with the indicated settings.
GenericParticle(Vector2f velocity, Vector2f acceleration, float scaleRate, float spinRate, float lifetime)
          Creates a GenericParticle with the indicated settings.
 
Method Summary
protected  void appendToParent()
          Adjusts this GenericParticle so that it is appropriately influenced by its parent.
 void update(int delta)
          Updates the GenericParticle based on its acceleration/velocity, scale rate, spin rate, and fade rate.
 
Methods inherited from class org.jrabbit.standard.game.objects.particles.base.Particle
draw, height, kill, setParent, setSkinID, skin, skinID, width
 
Methods inherited from class org.jrabbit.standard.game.objects.base.BaseSprite
bind, color, onscreen, release, render, screenCoords, setVisible, shouldRender, transforms, visible
 
Methods inherited from class org.jrabbit.standard.game.objects.base.Spatial
location, rotation, scalar, scaledDiameter, scaledHeight, scaledWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

velocity

protected Vector2f velocity
The particle's velocity.


acceleration

protected Vector2f acceleration
The particle's acceleration.


spinRate

protected float spinRate
The particle's rate of rotation.


scaleRate

protected float scaleRate
The particle's scaling rate.


fadeRate

protected float fadeRate
The rate at which the particle fades out of existence.

Constructor Detail

GenericParticle

public GenericParticle(float vX,
                       float vY,
                       float aX,
                       float aY,
                       float scaleRate,
                       float spinRate,
                       float lifetime)
Creates a generic particle with the indicated settings.

Parameters:
vX - The x-velocity of the particle.
vY - They y-velocity of the particle.
aX - The x-acceleration of the particle.
aY - The y-acceleration of the particle.
scaleRate - The rate at which the particle is scaled over time.
spinRate - The rate at which the particle is rotated.
lifetime - The duration of the fadeout of the particle, in seconds.

GenericParticle

public GenericParticle(Vector2f velocity,
                       Vector2f acceleration,
                       float scaleRate,
                       float spinRate,
                       float lifetime)
Creates a GenericParticle with the indicated settings.

Parameters:
velocity - The particle's velocity.
acceleration - The particle's acceleration.
scaleRate - The rate at which the particle is scaled over time.
spinRate - The rate at which the particle is rotated.
lifetime - The duration of the fadeout of the particle, in seconds.
Method Detail

update

public void update(int delta)
Updates the GenericParticle based on its acceleration/velocity, scale rate, spin rate, and fade rate.

Parameters:
delta - The number of microseconds that have passed.

appendToParent

protected void appendToParent()
Adjusts this GenericParticle so that it is appropriately influenced by its parent. NOTE: This changes the angle of the GenericParticle's trajectory by the rotation of the parent ParticleSprite.

Overrides:
appendToParent in class Particle