group1.model.gameobject.item
Class Item

java.lang.Object
  extended by group1.model.gameobject.GameObj
      extended by group1.model.gameobject.item.Item
Direct Known Subclasses:
Mushroom

public abstract class Item
extends GameObj

An abstract "pickup" item. This should have some particular effect on Jeff when he touches it. Such effects in traditional games include: restoring health, obtaining a weapon, transformations, etc. Items may also have detrimental effects, such as poison, damage, bad transformations (such as shrinking), or instant death. (It is suggested that any item disappear once it is touched. This prevents it from being picked up multiple times.)


Field Summary
 
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
Item(double x, double y, double w, double h, PictureList p)
          Constructor.
 
Method Summary
 void itemEffect(Jeff jeff)
          The effect of this item on Jeff.
protected  void makeItemRegions()
          Make the regions for an item.
 XYPair move(Environment env)
          Standard move function.
 
Methods inherited from class group1.model.gameobject.GameObj
addRegion, addRegion, equals, getAcceleration, getAccelerationX, getAccelerationY, getFilm, getHeight, getID, getNumRegions, getPictureList, getPosition, getPositionX, getPositionY, getRectangle, getRegion, getState, getTeam, getVelocity, getVelocityX, getVelocityY, getWidth, giveDamage, intersectRegions, isMovable, isSameState, makeBottomSideRegion, makeLeftSideRegion, makeRegions, makeRightSideRegion, makeSolid, makeSolidTop, makeTopSideRegion, playAudio, resizeBottomRegion, resizeLeftRegion, resizeRightRegion, resizeTopRegion, setAcceleration, setAcceleration, setAccelerationX, setAccelerationY, setID, setPictureList, setPosition, setPosition, setPositionX, setPositionY, setRectangle, setSize, setState, setTeam, setVelocity, setVelocity, setVelocityX, setVelocityY, shouldBeBlinking, stopHorizontal, stopVertical
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Item

public Item(double x,
            double y,
            double w,
            double h,
            PictureList p)
Constructor.

Parameters:
x - The x-position.
y - The y-position.
w - The width.
h - The height.
p - The picture list.
Method Detail

move

public XYPair move(Environment env)
Standard move function. Assumed movement: Just fall due to gravity. Can be overridden.

Specified by:
move in class GameObj
Parameters:
env - The environment.
Returns:
The velocity to move.

itemEffect

public void itemEffect(Jeff jeff)
The effect of this item on Jeff. (The default behavior is to simply disappear. This should be overridden.)

Parameters:
jeff - The Jeff object.

makeItemRegions

protected void makeItemRegions()
Make the regions for an item. (Items require special "isItem" regions to interact with Jeff in the correct way.)