pslib
Class TargetEmitter

java.lang.Object
  extended by pslib.GenericParticle
      extended by pslib.DynamicParticle
          extended by pslib.GenericEmitter
              extended by pslib.TargetEmitter
All Implemented Interfaces:
PSConstants

public class TargetEmitter
extends GenericEmitter

TargetEmitter Class

The TargetEmitter class extends the functionality of the GenericEmitter class by incorporating target seeking; attached particles will seek out the nearest attached target.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.


Field Summary
 
Fields inherited from interface pslib.PSConstants
CAM2D_LOOK, CAM2D_RIGHT, CAM2D_UP, CORNER, INVERSE, INVERSE_TRIANGULAR, LEADING, LINEAR, MIDPOINT, NONE, STATIC, TRAILING, TRIANGULAR
 
Constructor Summary
TargetEmitter(int b)
          Create a new object instance with the specified buffer size
TargetEmitter(int b, int d)
          Create a new object instance with the specified buffer size and decay time
 
Method Summary
 TargetEmitter copy()
          Return a copy of this emitter
 AttractiveForce[] getTargets()
          Return a reference to this objects targets
 void setTargets(AttractiveForce[] t)
          Set the targets for this object
protected  void updateParticle(DynamicParticle p)
          Update the specified particle
 
Methods inherited from class pslib.GenericEmitter
attach, attach, attachedParticles, clear, clearForces, debug, debug, getBufferSize, getDimensionScalars, getEmissionVector, getRadialVector, isDead, map, remove, render, render, setAlpha, setBufferSize, setColour, setColour, setColour, setColour, setDimensionScalars, setDirection, setDirectionMode, setForces, setForces, setInitialVelocity, setInitialVelocity, setMaxVelocity, setParticleStealing, setRadius, setRadius, setSpeed, setSpread, toArray, update
 
Methods inherited from class pslib.DynamicParticle
clearBehaviour, getBehaviour, getDecay, getDecayTime, getInitialDecayTime, getMass, getRenderAlpha, getRenderSize, getSnapshot, isDynamic, map, setAlphaEnvelope, setBehaviour, setBehaviour, setDecayTime, setMass, setSizeEnvelope
 
Methods inherited from class pslib.GenericParticle
getAlpha, getColour, getPosition, getSize, getVelocity, setPosition, setSize, setVelocity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TargetEmitter

public TargetEmitter(int b)
Create a new object instance with the specified buffer size

Parameters:
b - buffer size

TargetEmitter

public TargetEmitter(int b,
                     int d)
Create a new object instance with the specified buffer size and decay time

Parameters:
b - buffer size
d - decay (ms)
Method Detail

setTargets

public final void setTargets(AttractiveForce[] t)
Set the targets for this object

Parameters:
t - targets

getTargets

public final AttractiveForce[] getTargets()
Return a reference to this objects targets

Returns:
a reference to this objects targets

copy

public TargetEmitter copy()
Return a copy of this emitter

The returned copy contains references to the target vectors within the source emitter and will adhere to the rules defined in the GenericEmitter map() function.

Overrides:
copy in class GenericEmitter
Returns:
a copy of this emitter
See Also:
GenericEmitter

updateParticle

protected void updateParticle(DynamicParticle p)
Update the specified particle

Overrides:
updateParticle in class GenericEmitter
Parameters:
p - particle