vooga.examples.networking.zombies
Class Shooter

java.lang.Object
  extended by com.golden.gamedev.object.Sprite
      extended by vooga.engine.core.BetterSprite
          extended by vooga.examples.networking.zombies.Shooter
All Implemented Interfaces:
Constants

public class Shooter
extends BetterSprite
implements Constants

Player class. Contains all properties and abilities of the player


Field Summary
 
Fields inherited from interface vooga.examples.networking.zombies.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
Shooter()
           
 
Method Summary
 void addAmmo(int weapon, int amount)
          Add ammo to a weapon
 void addBulletToGame(Bullet bullet)
          Add a bullet sprite to the game world.
 int getAmmo()
          Gets the remaining ammo count on the current weapon
 Stat<java.lang.Integer> getHealth()
          Get the health stat object
 int getLevelScore()
          Get the player's score for the current level.
 double getOrientation()
          Get the direction the player is facing (in degrees)
 Stat<java.lang.Integer> getScore()
          Get the score stat object
 Stat<java.lang.Integer> getStatAmmo()
          Get the ammo as an object that's able to be displayed using overlays
 void goDown()
          Move the shooter down and play the corresponding animation.
 void goLeft()
          Move the shooter left and play the corresponding animation.
 void goRight()
          Move the shooter right and play the corresponding animation.
 void goUp()
          Move the shooter up and play the corresponding animation.
 boolean healthIsZero()
          Checks the player's health to see if he's still alive
 void resetLevelScore()
          Resets the score so that it can start counting new level's score from 0.
 void setAmmo()
           
 void setBulletListener(IEventHandler bulletlistener)
          This method sets the bullet listener for the player
 void setHealth(int number)
          Set health of the shooter
 void shoot()
          Initiate the shooting animation and fire bullets according to weapon choice
 void switchWeapons(int choice)
           
 void update(long elapsedTime)
          Update the shooter's image.
 void updateHealth(double d)
          update the health of the shooter
 void updateScore(int number)
          update score
 
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

Shooter

public Shooter()
Method Detail

setBulletListener

public void setBulletListener(IEventHandler bulletlistener)
This method sets the bullet listener for the player

Parameters:
bulletlistener -

addBulletToGame

public void addBulletToGame(Bullet bullet)
Add a bullet sprite to the game world. Used by weapons to create bullets

Parameters:
bullet - a bullet
angle - the angle of the bullet's trajectory

goLeft

public void goLeft()
Move the shooter left and play the corresponding animation.


goRight

public void goRight()
Move the shooter right and play the corresponding animation.


goUp

public void goUp()
Move the shooter up and play the corresponding animation.


goDown

public void goDown()
Move the shooter down and play the corresponding animation.


switchWeapons

public void switchWeapons(int choice)

shoot

public void shoot()
Initiate the shooting animation and fire bullets according to weapon choice


setAmmo

public void setAmmo()

getAmmo

public int getAmmo()
Gets the remaining ammo count on the current weapon

Returns:
remaining ammo count

addAmmo

public void addAmmo(int weapon,
                    int amount)
Add ammo to a weapon

Parameters:
weapon -
amount -

getStatAmmo

public Stat<java.lang.Integer> getStatAmmo()
Get the ammo as an object that's able to be displayed using overlays

Returns:
ammo stat object

getOrientation

public double getOrientation()
Get the direction the player is facing (in degrees)

Returns:
player orientation

healthIsZero

public boolean healthIsZero()
Checks the player's health to see if he's still alive

Returns:
true if the player's health is 0

setHealth

public void setHealth(int number)
Set health of the shooter


updateHealth

public void updateHealth(double d)
update the health of the shooter

Parameters:
d -

getHealth

public Stat<java.lang.Integer> getHealth()
Get the health stat object

Returns:
health stat objec

getScore

public Stat<java.lang.Integer> getScore()
Get the score stat object

Returns:
score stat object

resetLevelScore

public void resetLevelScore()
Resets the score so that it can start counting new level's score from 0.


getLevelScore

public int getLevelScore()
Get the player's score for the current level.

Returns:
levelScore The current level's score

updateScore

public void updateScore(int number)
update score


update

public void update(long elapsedTime)
Update the shooter's image. Update movement and then stand still so the player is not walking in place. Also checks the player's health for the end game condition, which is when the player's health reaches 0

Overrides:
update in class BetterSprite