|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object group1.model.gameobject.GameObj group1.model.gameobject.LivingObj
public abstract class LivingObj
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 |
---|
protected int curr_hp
protected int max_hp
protected double fireDamageMultiplier
protected double katanaDamageMultiplier
protected double tomahawkDamageMultiplier
protected double laserDamageMultiplier
protected double contactDamageMultiplier
Constructor Detail |
---|
public LivingObj()
public LivingObj(double x, double y, double w, double h, boolean moves, int hitPoints)
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 |
---|
public boolean takeDamage(double damage, char damageType)
damage
- The damage taken.damageType
- A value representing the kind of damage. 'f', 'k', 't', 'l', or 'c'.
protected void die()
Default: Nothing in particular happens.
public int getCurrHP()
public int getMaxHP()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |