group1.model.gameobject
Class Jeff

java.lang.Object
  extended by group1.model.gameobject.GameObj
      extended by group1.model.gameobject.LivingObj
          extended by group1.model.gameobject.Jeff

public class Jeff
extends LivingObj

Jeff, the hero of the game. A unique GameObj that determines its movement entirely on user input.


Field Summary
 
Fields inherited from class group1.model.gameobject.LivingObj
contactDamageMultiplier, curr_hp, fireDamageMultiplier, katanaDamageMultiplier, laserDamageMultiplier, max_hp, tomahawkDamageMultiplier
 
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
Jeff()
          Default constructor.
Jeff(double x, double y)
          Constructor.
 
Method Summary
 void changeWeapon(char nextWeapon)
          Change the weapon to the specified one.
 XYPair move(Environment env)
          Movement function that should be called by the Enviroment at each time click.
 
Methods inherited from class group1.model.gameobject.LivingObj
die, getCurrHP, getMaxHP, takeDamage
 
Methods inherited from class group1.model.gameobject.GameObj
addRegion, addRegion, getAcceleration, getAccelerationX, getAccelerationY, getHeight, getID, getNumRegions, getPosition, getPositionX, getPositionY, getRectangle, getRegion, getTeam, getVelocity, getVelocityX, getVelocityY, getWidth, intersectRegions, isMovable, makeRegions, makeSolid, setAcceleration, setAcceleration, setAccelerationX, setAccelerationY, setID, setPosition, setPosition, setPositionX, setPositionY, setRectangle, setSize, setTeam, setVelocity, setVelocity, setVelocityX, setVelocityY, stopHorizontal, stopVertical
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jeff

public Jeff()
Default constructor. Can be used by Game, for instance.


Jeff

public Jeff(double x,
            double y)
Constructor.

Parameters:
x - The x-coordinate of the position.
y - The y-coordinate of the position.
Method Detail

move

public XYPair move(Environment env)
Movement function that should be called by the Enviroment at each time click. This returns the "expected" velocity of this object. It's up to the environment to check hit detection of the various objects, and report back with the correct values. Jeff's case is easily the most complex. We figure out all movement from the keyboard inputs. Note that we freely change the current acceleration, but we only calculate and return temporary velocities.

Specified by:
move in class GameObj
Parameters:
env - The environment this object is moving in.
Returns:
An pair of 2 values: the proposed horizontal velocity, and the proposed vertical velocity.

changeWeapon

public void changeWeapon(char nextWeapon)
Change the weapon to the specified one. Prints an error message if the values don't make sense.

Parameters:
nextWeapon - A value representing the next weapon. Should be 'k', 'f', 'l', 't', or ' '.