org.jrabbit.standard.game.objects.particles.base
Class Particle

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
All Implemented Interfaces:
Renderable, Updateable, Skin, GLTransform, Colored, Dimensioned, GLGroupTransformed, Located, Rotated, Scaled, ScreenObject, Visible
Direct Known Subclasses:
AnimatedParticle, GenericParticle, SwarmParticle

public abstract class Particle
extends BaseSprite
implements Updateable

A Particle is a lightweight game object that is intended to updated and rendered, en-masse, by a ParticleSprite. By default, Particles are mostly independent of their parent ParticleSprites, but they do use the list of Skins maintained by their parent to render themselves. To animate a Particle, simply have its choice of Skin change over time.

Author:
Chris Molini

Field Summary
protected  ParticleSprite parent
          The ParticleSprite that contains, updates, and renders this Particle.
protected  int skinID
          This points to the Skin in the parent's array of Skins to use for rendering.
 
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
Particle()
           
 
Method Summary
protected  void appendToParent()
          Adjusts this Particle so that it is appropriately influenced by its parent.
 void draw()
          Renders the Particle's choice of Skin.
 float height()
          Accesses the Particle's dimensions.
 void kill()
          Removes this Particle from its parent.
 void setParent(ParticleSprite parent)
          Redefines the parent ParticleSprite reference and tells the particle to append itself to it.
 void setSkinID(int skinID)
          Redefines the Particle's choice of Skin.
 Skin skin()
          Accesses the Skin the particle is using.
 int skinID()
          Learns which Skin the Particle is using.
 float width()
          Accesses the Particle's dimensions.
 
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
 
Methods inherited from interface org.jrabbit.base.core.types.Updateable
update
 

Field Detail

parent

protected ParticleSprite parent
The ParticleSprite that contains, updates, and renders this Particle.


skinID

protected int skinID
This points to the Skin in the parent's array of Skins to use for rendering.

Constructor Detail

Particle

public Particle()
Method Detail

setParent

public void setParent(ParticleSprite parent)
Redefines the parent ParticleSprite reference and tells the particle to append itself to it.

Parameters:
parent - The new ParticleSprite to treat as a parent.

appendToParent

protected void appendToParent()
Adjusts this Particle so that it is appropriately influenced by its parent. Color, location, rotation, and scaling/flipping are all effected.


skinID

public int skinID()
Learns which Skin the Particle is using.

Returns:
The place in the array of Skins of its parent that this Particle uses.

setSkinID

public void setSkinID(int skinID)
Redefines the Particle's choice of Skin.

Parameters:
skinID - The new place in the array of Skins to use.

skin

public Skin skin()
Accesses the Skin the particle is using.

Returns:
The Skin in the array that is pointed to by this Particle.

kill

public void kill()
Removes this Particle from its parent.


width

public float width()
Accesses the Particle's dimensions.

Specified by:
width in interface Dimensioned
Returns:
The unscaled width of the Particle.

height

public float height()
Accesses the Particle's dimensions.

Specified by:
height in interface Dimensioned
Returns:
The unscaled height of the Particle.

draw

public void draw()
Renders the Particle's choice of Skin.

Specified by:
draw in class BaseSprite