|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Player
A Player object represents the person playing the game. The Player can move around, see the Room, and can take, drop, use, and look at Things.
| Field Summary | |
protected Room |
location
|
protected java.util.Vector |
thingsIAmHolding
|
| Constructor Summary | |
Player(Room location)
Constructor for the (single) object of class Player. |
|
| Method Summary | |
java.lang.String |
drop(java.lang.String thingName)
Attempts to drop a Thing being held by the Player. |
Room |
getMyLocation()
Returns this Player's current Room. |
java.lang.String |
go(java.lang.String direction)
Attempts to move the Player to an adjoining Room in the indicated direction. |
java.lang.String |
inventory()
Returns a String describing the Things that are in the user's "inventory" (the things the user is holding). |
java.lang.String |
look()
Returns information about the user's current location. |
java.lang.String |
look(java.lang.String thingName)
Attempts to look at a Thing that is either being held by the Player or is in the same Room as the Player. |
java.lang.String |
take(java.lang.String thingName)
Attempts to pick up a Thing from the Room that this Player is in. |
java.lang.String |
use(java.lang.String thingName)
Attempts to use a Thing being held by the Player. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected Room location
protected java.util.Vector thingsIAmHolding
| Constructor Detail |
public Player(Room location)
| Method Detail |
public Room getMyLocation()
public java.lang.String take(java.lang.String thingName)
thingName - the name of the Thing to be picked up.public java.lang.String drop(java.lang.String thingName)
thingName - the name of the Thing to be dropped.public java.lang.String use(java.lang.String thingName)
thingName - the name of the Thing to be dropped.public java.lang.String look(java.lang.String thingName)
thingName - the name of the Thing to be dropped.public java.lang.String look()
public java.lang.String inventory()
public java.lang.String go(java.lang.String direction)
direction - One of "north", "south", "east", "west", "up", or "down".
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||