vooga.games.zombieland
Class Zombie

java.lang.Object
  extended by com.golden.gamedev.object.Sprite
      extended by vooga.engine.core.BetterSprite
          extended by vooga.games.zombieland.Zombie
All Implemented Interfaces:
Constants

public class Zombie
extends BetterSprite
implements Constants

Zombie Class. Contains all behavior and controls for zombies in the game


Field Summary
 
Fields inherited from interface vooga.games.zombieland.Constants
ATTACKDOWN, ATTACKLEFT, ATTACKRIGHT, ATTACKUP, DEATH, DEFAULT_RESOURCE_DIRECTORY, GAME_HEIGHT, GAME_WIDTH, MAIN_CLASS, PLAYER_CLASS, PLAYER_DOWN, PLAYER_LEFT, PLAYER_RIGHT, PLAYER_UP, RESOURCE_FILENAME, STATES_XML_PATH, XML_PATH, ZOMBIE_DOWN, ZOMBIE_LEFT, ZOMBIE_RIGHT, ZOMBIE_UP
 
Constructor Summary
Zombie(java.lang.String name, int level, Shooter player, PlayState state)
           
 
Method Summary
 void calculateDamage(double damage)
          Update the zombie's health according to the damage taken
 double getDamage()
          Get the damage of the zombie
 java.lang.String getDirection()
          Returns the attack direction of the zombie.
 double getHealth()
           
 boolean isAbleToAttack()
          Tests to see if the AttackDelayStep has reached the threshold defined by AtttackDelay.
 boolean isDead()
          Tests whether the zombie has a health of 0.
 void resetAttackDelayStep()
          reset attack step
 void setAttackAnimation(java.lang.String side)
          Set the label for the current attack animation so it corresponds to the attack direction of the zombie
 void setDropItemListener(IEventHandler listener)
          This method sets up the drop item event
 void update(long elapsedTime)
          Keep track of heath and controls animation, movement, and item drop
 void updateAttackStep()
          Update attack step.
 void updateStats(int level)
           
static int zombiesPerLevel()
           
 
Methods inherited from class vooga.engine.core.BetterSprite
addAnimatedImages, addHorizontalSpeed, addImage, addSprite, addVerticalSpeed, firstRun, forceX, forceY, getCurrentSprite, getDistance, getDoubleStat, getHeight, getHorizontalSpeed, getImage, getIntStat, getStat, getTimeInExistence, getVerticalSpeed, getWidth, getX, getY, isActive, isOnScreen, move, moveTo, moveX, moveY, render, setActive, setAsRenderedSprite, setBackground, setDoubleStat, setHorizontalSpeed, setImage, setImages, setIntStat, setLayer, setLocation, setMovement, setSpeed, setStat, setVerticalSpeed, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Zombie

public Zombie(java.lang.String name,
              int level,
              Shooter player,
              PlayState state)
Method Detail

updateStats

public void updateStats(int level)

getHealth

public double getHealth()

zombiesPerLevel

public static int zombiesPerLevel()

isDead

public boolean isDead()
Tests whether the zombie has a health of 0. Used to keep track of and remove zombies when they have been killed

Returns:

isAbleToAttack

public boolean isAbleToAttack()
Tests to see if the AttackDelayStep has reached the threshold defined by AtttackDelay. If so, the zombie is able to attack and vice versa. Used to restrict the number of attacks for a single zombie

Returns:
true if the zombie is ready for the next attack

getDamage

public double getDamage()
Get the damage of the zombie

Returns:
damage of the zombie

getDirection

public java.lang.String getDirection()
Returns the attack direction of the zombie. The up and down is reversed because the coordinate system has its positive y axis in the down direction, so everything's flipped when it comes to y.

Returns:
attack direction

calculateDamage

public void calculateDamage(double damage)
Update the zombie's health according to the damage taken

Parameters:
damage - damage taken by the zombie

updateAttackStep

public void updateAttackStep()
Update attack step. Used to force intervals between attacks


resetAttackDelayStep

public void resetAttackDelayStep()
reset attack step


setAttackAnimation

public void setAttackAnimation(java.lang.String side)
Set the label for the current attack animation so it corresponds to the attack direction of the zombie

Parameters:
side - attack direction

update

public void update(long elapsedTime)
Keep track of heath and controls animation, movement, and item drop

Overrides:
update in class BetterSprite

setDropItemListener

public void setDropItemListener(IEventHandler listener)
This method sets up the drop item event

Parameters:
listener -