student.adventure
Class Player

java.lang.Object
  extended by student.adventure.Player

public class Player
extends java.lang.Object

This class represents a player in an adventure game. Each player has a current location.

Version:
1.0 (December 2002)
Author:
Michael Kolling

Constructor Summary
Player()
          Constructor for objects of class Player
 
Method Summary
 Room getCurrentRoom()
          Return the current room for this player.
 void setCurrentRoom(Room room)
          Set the current room for this player.
 void walk(java.lang.String direction)
          Try to walk in a given direction.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player()
Constructor for objects of class Player

Method Detail

getCurrentRoom

public Room getCurrentRoom()
Return the current room for this player.

Returns:
The room the player is currently in

setCurrentRoom

public void setCurrentRoom(Room room)
Set the current room for this player.

Parameters:
room - The room to move to

walk

public void walk(java.lang.String direction)
Try to walk in a given direction. If there is a door this will change the player's location.

Parameters:
direction - Which way to walk