Class Person

java.lang.Object
  |
  +--java.awt.Component
        |
        +--MapObject
              |
              +--People
                    |
                    +--Person
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Person
extends People

Class to define a NPC, carries Monsters, and Items.

See Also:
People, Serialized Form

Field Summary
protected  PersonAI ai
          The AI to control movement around the Grid
protected static java.awt.Image bimg
          The four Images to paint corresponding to the four directions
protected static java.awt.Image img
          The four Images to paint corresponding to the four directions
protected static java.awt.Image limg
          The four Images to paint corresponding to the four directions
protected static java.awt.Image rimg
          The four Images to paint corresponding to the four directions
 
Fields inherited from class People
activeMon, battling, beaten, behind, dir, dlg, hmon, items, MAXMON, mon, money, name
 
Fields inherited from class MapObject
BUILDING, enterable, FLOOR, GRASS, MONSTER, PERSON, PLAYER, REDIRECT, ROCK, TRAINER, type, WALL
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Person()
          Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on Grass Facing up
Person(int dir)
          Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on Grass Facing as specified
Person(MapObject behind)
          Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on MapObject specified Facing up
Person(MapObject behind, int dir)
          Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on MapObject specified Facing as specified
Person(java.lang.String name)
          Construct a default Player, Name as specified No Money No Monsters No Items No Badges No Dialogue Standing on Grass Facing up
Person(java.lang.String name, MapObject behind, int dir)
          Construct a default Player, Name as specified No Money No Monsters No Items No Badges No Dialogue Standing on MapObject specified Facing as specified
 
Method Summary
 MapObject getClone()
          Returns a clone of this having the same name, behind and direction facing.
 void paint(java.awt.Graphics g)
          Draws the image for this based upon the direction.
 void setGrid(Grid g)
          Sets th Grid for the PersonAI to use, and initiates the PersonAI.
 void setImage(java.awt.Image[] img)
          Sets the Image for this.
 
Methods inherited from class People
addItem, addMonster, addMonsterHome, battle, beat, getActiveMonster, getBehind, getDialogue, getDirection, getItem, getItemCount, getItems, getMoney, getMonster, getMonsterAtHome, getMonsterAttacks, getMonsters, getName, getNumberOfMonsters, getNumberOfMonstersAtHome, healAllMonsters, isBattling, isBeaten, isEnterable, setActiveMonster, setBehind, setDialogue, setDirection, setMoney, setName, stopBattle, switchMonster, useItem
 
Methods inherited from class MapObject
canBeEntered, getType
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

img

protected static java.awt.Image img
The four Images to paint corresponding to the four directions


bimg

protected static java.awt.Image bimg
The four Images to paint corresponding to the four directions


limg

protected static java.awt.Image limg
The four Images to paint corresponding to the four directions


rimg

protected static java.awt.Image rimg
The four Images to paint corresponding to the four directions


ai

protected PersonAI ai
The AI to control movement around the Grid

See Also:
PersonAI, Grid
Constructor Detail

Person

public Person()
Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on Grass Facing up

See Also:
Item, Monster

Person

public Person(int dir)
Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on Grass Facing as specified

Parameters:
dir - the direction facing as specified in Grid
See Also:
Grid, Item, Monster

Person

public Person(MapObject behind)
Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on MapObject specified Facing up

Parameters:
behind - the MapObject to stand on
See Also:
Item, Monster

Person

public Person(MapObject behind,
              int dir)
Construct a default Player, Name of NPC No Money No Monsters No Items No Badges No Dialogue Standing on MapObject specified Facing as specified

Parameters:
behind - the MapObject to stand on
dir - the direction facing as specified in Grid
See Also:
Item, Monster

Person

public Person(java.lang.String name)
Construct a default Player, Name as specified No Money No Monsters No Items No Badges No Dialogue Standing on Grass Facing up

Parameters:
name - the Name for this, needs to be unique for a Grid
See Also:
Grid, Item, Monster

Person

public Person(java.lang.String name,
              MapObject behind,
              int dir)
Construct a default Player, Name as specified No Money No Monsters No Items No Badges No Dialogue Standing on MapObject specified Facing as specified

Parameters:
name - the Name for this, needs to be unique for a Grid
behind - the MapObject to stand on
dir - the direction facing as specified in Grid
See Also:
Grid, Item, Monster
Method Detail

setImage

public void setImage(java.awt.Image[] img)
Sets the Image for this. Needs to be called before calls to paint

Specified by:
setImage in class MapObject
Parameters:
img - the array of Image to use, needs be length 4.

setGrid

public void setGrid(Grid g)
Sets th Grid for the PersonAI to use, and initiates the PersonAI.

Parameters:
g - the Grid to pass to PersonAI
See Also:
Grid, PersonAI

getClone

public MapObject getClone()
Returns a clone of this having the same name, behind and direction facing.

Specified by:
getClone in class MapObject
Returns:
a clone of this having the same name, behind and direction facing.

paint

public void paint(java.awt.Graphics g)
Draws the image for this based upon the direction.

Overrides:
paint in class java.awt.Component
Parameters:
g - the Graphics