|
|||||||||
| 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
group1.model.gameobject.enemy.Enemy
public class Enemy
Enemy is a living enemy in the game. Unlike Jeff, who moves
based on user input, an Enemy moves based on its own personal desires
determined by a random value generator.
| Field Summary |
|---|
| Fields inherited from class group1.model.gameobject.LivingObj |
|---|
contactDamageMultiplier, curr_hp, fireDamageMultiplier, katanaDamageMultiplier, laserDamageMultiplier, max_hp, ourFacingDirection, tomahawkDamageMultiplier, VALID_WEAPON_CODES |
| 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 | |
|---|---|
Enemy()
Default constructor. |
|
Enemy(double x,
double y,
double w,
double h,
int hp,
PictureList p,
boolean useStandardRegions,
double attackPower)
Constructor designed for greater control over enemy size and hp. |
|
Enemy(double x,
double y,
PictureList p)
Constructor. |
|
| Method Summary | |
|---|---|
double |
attackPower()
The default attack power. |
int |
attackProbabilityDenominator()
The probability that this Enemy will attack at a particular time step is attackProbabilityNumerator() out of attackProbabilityDenominator(). |
int |
attackProbabilityNumerator()
The probability that this Enemy will attack at a particular time step is attackProbabilityNumerator() out of attackProbabilityDenominator(). |
int |
changeWeaponProbabilityDenominator()
The probability that this Enemy will change weapons at a particular time step is changeWeaponProbabilityNumerator() out of changeWeaponProbabilityDenominator(). |
int |
changeWeaponProbabilityNumerator()
The probability that this Enemy will change weapons at a particular time step is changeWeaponProbabilityNumerator() out of changeWeaponProbabilityDenominator(). |
protected void |
die()
An overridable method that defines exactly what happens to an Enemy when it dies. |
java.util.Random |
getRandomGenerator()
Returns the random value generator that this Enemy is using. |
protected void |
makeStandardEnemyRegions(double attackPower)
Create the object regions special for a standard enemy, such as a Goomba. |
double |
maxRunSpeed()
The maximum running speed. |
double |
maxWalkSpeed()
The maximum walking speed. |
XYPair |
move(Environment env)
Movement function that should be called by the Environment at each time click. |
double |
projectileSpeed()
The default speed of projectiles created by this Enemy. |
double |
runAcceleration()
The acceleration while running. |
protected void |
setPointValue(int pointValue)
Set the number of points this enemy is worth. |
void |
setRandomGenerator(java.util.Random newGenerator)
Set this Enemy object to use another random value generator. |
protected boolean |
shouldBeMoving(Environment env)
In the interest of not letting enemies run around on their own (and into pits, even), we might choose to only move an enemy if they've come within a set distance to Jeff. |
static int |
startingHP()
Enemy's starting maximum hit points. |
double |
walkAcceleration()
The acceleration while walking. |
double |
walkSpeed()
The default walk speed. |
| Methods inherited from class group1.model.gameobject.LivingObj |
|---|
changeDirectionFacing, changeWeapon, decrementInvincibilityCounter, facingWhichDirection, getCurrentWeapon, getCurrHP, getMaxHP, hasFireball, hasKatana, hasLaser, hasTomahawk, hasWeapon, hasWeaponIndex, isInvincible, setInvincibilityPeriod, setVulnerable, takeDamage |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Enemy(double x,
double y,
PictureList p)
x - The x-coordinate of the position.y - The y-coordinate of the position.
public Enemy(double x,
double y,
double w,
double h,
int hp,
PictureList p,
boolean useStandardRegions,
double attackPower)
x - The x-coordinate of the position.y - The y-coordinate of the position.w - The width of the enemy.h - The height of the enemy.hp - The max hp of the enemy.p - The picture list.useStandardRegions - Whether or not to use the "standard enemy" regions. (See makeStandardEnemyRegions method.)attackPower - The attack power of the enemy. (May be null if the subclass is not using the standard regions.)public Enemy()
| Method Detail |
|---|
public static int startingHP()
public int attackProbabilityNumerator()
public int attackProbabilityDenominator()
public int changeWeaponProbabilityNumerator()
public int changeWeaponProbabilityDenominator()
public double maxWalkSpeed()
public double maxRunSpeed()
public double walkAcceleration()
public double runAcceleration()
public double walkSpeed()
public double attackPower()
public double projectileSpeed()
public java.util.Random getRandomGenerator()
public void setRandomGenerator(java.util.Random newGenerator)
public XYPair move(Environment env)
move in class GameObjenv - The environment that this object is moving in.
protected void makeStandardEnemyRegions(double attackPower)
protected boolean shouldBeMoving(Environment env)
env - The environment the enemy and Jeff are in.
protected void setPointValue(int pointValue)
pointValue - The amount of points gained for defeating this enemy.protected void die()
Default: Whatever LivingObj.java specifies (should be just removing the object), and awarding the point value of this enemy to the player.
die in class LivingObj
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||