class Player extends AnyRef
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.
- Alphabetic
- By Inheritance
- Player
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def drop(itemName: String): String
Tries to drop an item of the given name.
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!".
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def examine(itemName: String): String
Causes the player to examine the item of the given name.
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."
- def get(itemName: String): String
Tries to pick up an item of the given name.
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. Returns a description of the result: "You pick up the ITEM." or "There is no ITEM here to pick up."
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def go(direction: String): String
Attempts to move the player in the given 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."
- def has(itemName: String): Boolean
Determines whether the player is carrying an item of the given name.
- def hasQuit: Boolean
Determines if the player has indicated a desire to quit the game.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def inventory: String
Causes the player to list what they are carrying.
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.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def location: Area
Returns the current location of the player.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def quit(): String
Signals that the player wants to quit the game.
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).
- def rest(): String
Causes the player to rest for a short while (this has no substantial effect in game terms).
Causes the player to rest for a short while (this has no substantial effect in game terms). Returns a description of what happened.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
Returns a brief description of the player's state, for debugging purposes.
Returns a brief description of the player's state, for debugging purposes.
- Definition Classes
- Player → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.