com.planeth.gtroids.obj.base
Class AbstractAnimatedObject

java.lang.Object
  extended bycom.planeth.gtroids.obj.base.PaintableObject
      extended bycom.planeth.gtroids.obj.base.AbstractGameObject
          extended bycom.planeth.gtroids.obj.base.AbstractPhysicalObject
              extended bycom.planeth.gtroids.obj.base.AbstractAnimatedObject
All Implemented Interfaces:
ITimeControllable
Direct Known Subclasses:
AbstractTumblingObject, Asteroid, PatrolShip, Ship, Shot

public abstract class AbstractAnimatedObject
extends AbstractPhysicalObject

The abstraction of an animated object

Author:
Andreas Grässer, gal@planet-h.com.
created May 6, 2005

Constructor Summary
AbstractAnimatedObject(Shape baseShape)
          Constructor for AbstractAnimatedObject.
 
Method Summary
protected  void checkBorderJump()
          Moves the object, if it's going out of the GamePanel to the opposite side of the panel.
 double getCircumferentialVel(Vector2D point, int direction)
          Returns the circumferencial velocity on the desired side (direction = north, east, south, west) at the desired vector (point).
protected  Vector2D getLastPos()
          Returns the pos at last step
protected  RealTimeControl getRealTimeControl()
          Returns the realTimeControl.
protected  double getRotationVelDeg()
          Returns the rotationVel in degrees
 Vector2D getVel()
          Returns the vel of the Object.
protected  boolean isSpeedDependent()
          Returns true, if the object is speed dependent.
 void paint(java.awt.Graphics g)
          Paints the object into the passed Graphics
 void pause(boolean pauseState)
          Pauses/unpauses the object or components of the object, which have to be paused.
protected  void setBorderJumper(boolean borderJumper)
          If set to true, the object jumps through the borders.
 void setCircumferentialVel(double circumferentialVel, Vector2D point, int direction)
          Sets the circumferencial velocity on the desired side (direction = north, east, south, west) at the desired vector (point).
 void setRotationVelDeg(double rotationVelDeg)
          Sets the rotationVel in degrees
 void setSpeedDependent(boolean speedDependent)
          If set to true, the object is speed dependent.
 void setVel(Vector2D vel)
          Sets the vel of the Object.
 void update()
          Does one update step for the Object
protected  void update(double timeFactor, double speedFactor)
          Does one time and speed dependent update step for the Object
 
Methods inherited from class com.planeth.gtroids.obj.base.AbstractPhysicalObject
die, getCenterOfMass, getElast, getExplodeSound, getGamePanel, getGravit, getObjectFactory, getQuadrantCoords, getVolume, hitWith, hitWithBomb, isAffectingGame, setAffectingGame, setGamePanel, setGravit, setLifeTime, setQuadrantCoords, split
 
Methods inherited from class com.planeth.gtroids.obj.base.AbstractGameObject
cure, getAudioResource, getColorBackup, getStats, getTimerManager, initStats, isEnemy, isReadyToDie, kill, setColorBackup, setColorFixed, setReadyToDie
 
Methods inherited from class com.planeth.gtroids.obj.base.PaintableObject
addShape, explodeBaseShape, getAvgDiameter, getAvgVector, getBaseColor, getBaseVertexes, getBounds, getMaxRadius, getNrOfVertexes, getOrientation, getPos, move, paintAtPos, randomizeBaseShape, rotate, setBaseColor, splitBaseShape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAnimatedObject

public AbstractAnimatedObject(Shape baseShape)
Constructor for AbstractAnimatedObject.

Parameters:
baseShape - the baseShape of the object
Method Detail

pause

public void pause(boolean pauseState)
Description copied from class: AbstractGameObject
Pauses/unpauses the object or components of the object, which have to be paused.

Specified by:
pause in interface ITimeControllable
Specified by:
pause in class AbstractGameObject
See Also:
ITimeControllable.pause(boolean)

getCircumferentialVel

public double getCircumferentialVel(Vector2D point,
                                    int direction)
Returns the circumferencial velocity on the desired side (direction = north, east, south, west) at the desired vector (point).

Parameters:
point - the vector, on which the circumfercencial vel should be taken
direction - the direction (side), on which the circumfercencial vel should be taken
Returns:
Returns the circumferencial velocity

setCircumferentialVel

public void setCircumferentialVel(double circumferentialVel,
                                  Vector2D point,
                                  int direction)
Sets the circumferencial velocity on the desired side (direction = north, east, south, west) at the desired vector (point).

Parameters:
circumferentialVel - the circumferentialVel to set
point - the vector, on which the circumfercencial vel should be taken
direction - the direction (side), on which the circumfercencial vel should be taken

checkBorderJump

protected void checkBorderJump()
Moves the object, if it's going out of the GamePanel to the opposite side of the panel.


paint

public void paint(java.awt.Graphics g)
Description copied from class: PaintableObject
Paints the object into the passed Graphics

Overrides:
paint in class AbstractPhysicalObject
See Also:
PaintableObject.paint(java.awt.Graphics)

update

public void update()
Description copied from class: AbstractGameObject
Does one update step for the Object

Overrides:
update in class AbstractPhysicalObject
See Also:
AbstractGameObject.update()

update

protected void update(double timeFactor,
                      double speedFactor)
Does one time and speed dependent update step for the Object

Parameters:
timeFactor - the timefactor which affects the stepsize
speedFactor - the speedfactor which affects the stepsize

getVel

public Vector2D getVel()
Returns the vel of the Object.

Overrides:
getVel in class AbstractPhysicalObject
Returns:
Returns the vel of the Object.

setVel

public void setVel(Vector2D vel)
Sets the vel of the Object.

Parameters:
vel - The vel to set.

getRotationVelDeg

protected double getRotationVelDeg()
Returns the rotationVel in degrees

Returns:
Returns the rotationVel in degrees

setRotationVelDeg

public void setRotationVelDeg(double rotationVelDeg)
Sets the rotationVel in degrees

Parameters:
rotationVelDeg - The rotateSpeed to set (degrees).

getRealTimeControl

protected RealTimeControl getRealTimeControl()
Returns the realTimeControl.

Returns:
Returns the realTimeControl.

getLastPos

protected Vector2D getLastPos()
Returns the pos at last step

Overrides:
getLastPos in class AbstractPhysicalObject
Returns:
Returns the pos at last step.

isSpeedDependent

protected boolean isSpeedDependent()
Returns true, if the object is speed dependent.

Returns:
Returns true, if the object is speed dependent.

setSpeedDependent

public void setSpeedDependent(boolean speedDependent)
If set to true, the object is speed dependent.

Parameters:
speedDependent - true = speed dependent, false = speed independent

setBorderJumper

protected void setBorderJumper(boolean borderJumper)
If set to true, the object jumps through the borders.
If set to false, the object collides with the borders.

Parameters:
borderJumper - true for borderJumper, false for borderCollider