|
|||||||||
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. |
static java.lang.String |
VALID_WEAPON_CODES
List of all valid weapon codes, each a single character. |
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,
PictureList p)
Constructor. |
Method Summary | |
---|---|
void |
changeWeapon(char nextWeapon)
Change the weapon to the specified one. |
protected void |
die()
An overridable method that defines exactly what happens to a LivingObj when it dies. |
char |
getCurrentWeapon()
Returns the letter code for the current weapon, or ' ' if not using a weapon right now. |
int |
getCurrHP()
Get the current hit points. |
int |
getMaxHP()
Get the maximum value for hit points. |
boolean |
hasFireball()
Returns true if object has a fireball. |
boolean |
hasKatana()
Returns true if object has a katana. |
boolean |
hasLaser()
Returns true if object has a laser. |
boolean |
hasTomahawk()
Returns true if object has a tomahawk. |
boolean |
hasWeapon(char weaponCode)
Returns true if object currently has the specified weapon, else false. |
boolean |
hasWeaponIndex(int index)
Returns true if object currently has the specified weapon, else false. |
boolean |
takeDamage(double damage,
char damageType)
Take damage, depleting hit points. |
Methods inherited from class group1.model.gameobject.GameObj |
---|
addRegion, addRegion, equals, getAcceleration, getAccelerationX, getAccelerationY, getFilm, getFilm, getHeight, getID, getNumRegions, getPictureList, getPosition, getPositionX, getPositionY, getRectangle, getRegion, getState, getTeam, getVelocity, getVelocityX, getVelocityY, getWidth, intersectRegions, isMovable, isSameState, makeRegions, makeSolid, makeSolidTop, move, setAcceleration, setAcceleration, setAccelerationX, setAccelerationY, setID, setPictureList, setPosition, setPosition, setPositionX, setPositionY, setRectangle, setSize, setState, setTeam, setVelocity, setVelocity, setVelocityX, setVelocityY, stopHorizontal, stopVertical |
Methods inherited from class java.lang.Object |
---|
clone, 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
public static final java.lang.String VALID_WEAPON_CODES
Constructor Detail |
---|
public LivingObj()
public LivingObj(double x, double y, double w, double h, boolean moves, int hitPoints, PictureList p)
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 int getCurrHP()
public int getMaxHP()
public char getCurrentWeapon()
public boolean hasWeaponIndex(int index) throws java.lang.IndexOutOfBoundsException
index
- Index into VALID_WEAPON_CODES pointing to the weapon code
in question.
java.lang.IndexOutOfBoundsException
- if (index < 0) or
(index >= VALID_WEAPON_CODES.length()).public boolean hasWeapon(char weaponCode)
weaponCode
- The letter code for the weapon in question.
public boolean hasKatana()
public boolean hasFireball()
public boolean hasLaser()
public boolean hasTomahawk()
public void changeWeapon(char nextWeapon)
nextWeapon
- The letter code for the next weapon,
or ' ' for no weapon.
See documentation of VALID_WEAPON_CODES for list valid codes.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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |