group1.model.gameobject
Class LivingObj

java.lang.Object
  extended by group1.model.gameobject.GameObj
      extended by group1.model.gameobject.LivingObj
Direct Known Subclasses:
Jeff

public abstract class LivingObj
extends GameObj

A "living" game object, which has hp, can receive damage, and can die. (Use this class for enemies and for Jeff.)


Field Summary
protected  double contactDamageMultiplier
          The multiplier for weakness/resistance to direct contact damage.
protected  int curr_hp
          The current hit points.
protected  double fireDamageMultiplier
          The multiplier for weakness/resistance to fire damage.
protected  double katanaDamageMultiplier
          The multiplier for weakness/resistance to katana damage.
protected  double laserDamageMultiplier
          The multiplier for weakness/resistance to laser damage.
protected  int max_hp
          The maximum hit points.
protected  double tomahawkDamageMultiplier
          The multiplier for weakness/resistance to tomahawk damage.
 
Fields inherited from class group1.model.gameobject.GameObj
acceleration, ENEMY_TEAM, GRID_SPACE_SIZE, id, isMovable, JEFF_TEAM, NO_TEAM, regions, shape, velocity
 
Constructor Summary
LivingObj()
          Default constructor.
LivingObj(double x, double y, double w, double h, boolean moves, int hitPoints)
          Constructor.
 
Method Summary
protected  void die()
          An overridable method that defines exactly what happens to a LivingObj when it dies.
 int getCurrHP()
          Get the current hit points.
 int getMaxHP()
          Get the maximum value for hit points.
 boolean takeDamage(double damage, char damageType)
          Take damage, depleting hit points.
 
Methods inherited from class group1.model.gameobject.GameObj
addRegion, addRegion, getAcceleration, getAccelerationX, getAccelerationY, getHeight, getID, getNumRegions, getPosition, getPositionX, getPositionY, getRectangle, getRegion, getTeam, getVelocity, getVelocityX, getVelocityY, getWidth, intersectRegions, isMovable, makeRegions, makeSolid, move, setAcceleration, setAcceleration, setAccelerationX, setAccelerationY, setID, setPosition, setPosition, setPositionX, setPositionY, setRectangle, setSize, setTeam, setVelocity, setVelocity, setVelocityX, setVelocityY, stopHorizontal, stopVertical
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

curr_hp

protected int curr_hp
The current hit points.


max_hp

protected int max_hp
The maximum hit points.


fireDamageMultiplier

protected double fireDamageMultiplier
The multiplier for weakness/resistance to fire damage.


katanaDamageMultiplier

protected double katanaDamageMultiplier
The multiplier for weakness/resistance to katana damage.


tomahawkDamageMultiplier

protected double tomahawkDamageMultiplier
The multiplier for weakness/resistance to tomahawk damage.


laserDamageMultiplier

protected double laserDamageMultiplier
The multiplier for weakness/resistance to laser damage.


contactDamageMultiplier

protected double contactDamageMultiplier
The multiplier for weakness/resistance to direct contact damage.

Constructor Detail

LivingObj

public LivingObj()
Default constructor.


LivingObj

public LivingObj(double x,
                 double y,
                 double w,
                 double h,
                 boolean moves,
                 int hitPoints)
Constructor.

Parameters:
x - The x-position.
y - The y-position.
w - The width.
h - The height.
moves - Whether or not the object can move.
hitPoints - The max HP.
Method Detail

takeDamage

public boolean takeDamage(double damage,
                          char damageType)
Take damage, depleting hit points. Damage might be affected by in-born weaknesses or resistances.

Parameters:
damage - The damage taken.
damageType - A value representing the kind of damage. 'f', 'k', 't', 'l', or 'c'.
Returns:
true if this object is now out of hit points.

die

protected void die()
An overridable method that defines exactly what happens to a LivingObj when it dies. (Like, does it fall off of the screen, or something?)

Default: Nothing in particular happens.


getCurrHP

public int getCurrHP()
Get the current hit points.

Returns:
The HP.

getMaxHP

public int getMaxHP()
Get the maximum value for hit points.

Returns:
The max HP.