Packages

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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Player
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Player(startingArea: Area)

    startingArea

    the initial location of the player

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. 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!".

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. 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."

  10. 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."

  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. 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."

  13. def has(itemName: String): Boolean

    Determines whether the player is carrying an item of the given name.

  14. def hasQuit: Boolean

    Determines if the player has indicated a desire to quit the game.

  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. 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.

  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def location: Area

    Returns the current location of the player.

  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. 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).

  23. 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.

  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. 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
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. 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.

Inherited from AnyRef

Inherited from Any

Ungrouped