|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgroup1.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 Direction |
ourFacingDirection
The direction in which the LivingObj is facing. |
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, myState, NO_TEAM, regions, shape, THICKNESS, 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 |
changeDirectionFacing(Direction newDirection)
Set the direction in which this LivingObj faces. |
void |
changeWeapon(char nextWeapon)
Change the weapon to the specified one. |
boolean |
decrementInvincibilityCounter()
Decrement the invincibility counter of this object. |
protected void |
die()
An overridable method that defines exactly what happens to a LivingObj when it dies. |
Direction |
facingWhichDirection()
The direction in which the LivingObj is facing. |
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 |
isInvincible()
Return whether or not this living object is temporarily invincible. |
protected void |
setInvincibilityPeriod(long period)
Set the amount of time this object should be invincible for. |
void |
setVulnerable()
Make an object no longer invincible, assuming it already was. |
int |
takeDamage(double damage,
char damageType)
Take damage, depleting hit points. |
| 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
protected Direction ourFacingDirection
| 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.p - The picture list.| 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 Direction facingWhichDirection()
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 void changeDirectionFacing(Direction newDirection)
protected void setInvincibilityPeriod(long period)
period - The invincibility period.
public int 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: Just remove this object from the Environment.
public boolean decrementInvincibilityCounter()
public boolean isInvincible()
public void setVulnerable()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||