Player
A Player
object represents a player character controlled by the real-life user of the program.
A player object’s state is mutable: the player’s location and possessions can change, for instance.
Parameters
- startingArea
-
the player’s initial location
Attributes
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Tries to drop an item of the given name. This is successful if such an item is currently in the player’s possession. If so, the item is removed from the player’s inventory and placed in the area. Returns a description of the result of the attempt: "You drop the ITEM." or "You don't have that!".
Tries to drop an item of the given name. This is successful if such an item is currently in the player’s possession. If so, the item is removed from the player’s inventory and placed in the area. Returns a description of the result of the attempt: "You drop the ITEM." or "You don't have that!".
Attributes
Causes the player to examine the item of the given name. This is successful if such an item is currently in the player’s possession. Returns a description of the result, which, if the attempt is successful, includes a description of the item. The description has the form: "You look closely at the ITEM.\nDESCRIPTION" or "If you want to examine something, you need to pick it up first."
Causes the player to examine the item of the given name. This is successful if such an item is currently in the player’s possession. Returns a description of the result, which, if the attempt is successful, includes a description of the item. The description has the form: "You look closely at the ITEM.\nDESCRIPTION" or "If you want to examine something, you need to pick it up first."
Attributes
Tries to pick up an item of the given name. This is successful if such an item is located in the player’s current location. If so, the item is added to the player’s inventory and removed from the location. Returns a description of the result: "You pick up the ITEM." or "There is no ITEM here to pick up."
Tries to pick up an item of the given name. This is successful if such an item is located in the player’s current location. If so, the item is added to the player’s inventory and removed from the location. Returns a description of the result: "You pick up the ITEM." or "There is no ITEM here to pick up."
Attributes
Attempts to move the player in the given direction. This is successful if there is an exit from the player’s current location towards the direction name. Returns a description of the result: "You go DIRECTION." or "You can't go DIRECTION."
Attempts to move the player in the given direction. This is successful if there is an exit from the player’s current location towards the direction name. Returns a description of the result: "You go DIRECTION." or "You can't go DIRECTION."
Attributes
Determines whether the player is carrying an item of the given name.
Determines whether the player is carrying an item of the given name.
Attributes
Determines if the player has indicated a desire to quit the game.
Determines if the player has indicated a desire to quit the game.
Attributes
Causes the player to list what they are carrying. Returns a listing of the player’s possessions or a statement indicating that the player is carrying nothing. The return value has the form "You are carrying:\nITEMS ON SEPARATE LINES" or "You are empty-handed." The items are listed in an arbitrary order.
Causes the player to list what they are carrying. Returns a listing of the player’s possessions or a statement indicating that the player is carrying nothing. The return value has the form "You are carrying:\nITEMS ON SEPARATE LINES" or "You are empty-handed." The items are listed in an arbitrary order.
Attributes
Returns the player’s current location.
Returns the player’s current location.
Attributes
Signals that the player wants to quit the game. Returns a description of what happened within the game as a result (which is the empty string, in this case).
Signals that the player wants to quit the game. Returns a description of what happened within the game as a result (which is the empty string, in this case).
Attributes
Causes the player to rest for a short while (this has no substantial effect in game terms). Returns a description of what happened.
Causes the player to rest for a short while (this has no substantial effect in game terms). Returns a description of what happened.