obj
Class Player
java.lang.Object
obj.Entity
obj.Character
obj.Player
public class Player
- extends Character
Constructor Summary |
Player(Grid startingGrid,
Room startingRoom)
|
Player(java.lang.String name,
int age,
java.lang.String gender,
Grid startingGrid,
Room startingRoom)
Initializes basic player characteristics, such as name, gender, etc. |
Methods inherited from class obj.Entity |
addIdentifier, addIdentifiers, getDesc, getName, getRoomDesc, hasIdentifier, makeInvisible, makeVisible, setDesc, setIdentifiers, setName, setRoomDesc, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Player
public Player(java.lang.String name,
int age,
java.lang.String gender,
Grid startingGrid,
Room startingRoom)
- Initializes basic player characteristics, such as name, gender, etc.
Sets the starting grid and room.
Player
public Player(Grid startingGrid,
Room startingRoom)
getItem
public Item getItem(java.lang.String itemName)
- Returns:
- A specific item from the player's inventory
If the item is not found, null is returned instead.
addToInventory
public void addToInventory(Item i)
- Adds an item to the player's inventory.
removeItem
public boolean removeItem(java.lang.String itemName)
- Returns:
- true if item was removed, false if not
setRoom
public void setRoom(Room newRoom)
- Effectively moves the player to whatever room is specified.
- Parameters:
newRoom
- The room to move the player to.
getRoom
public Room getRoom()
- Returns:
- the room that the player is in.
setGrid
public void setGrid(Grid newGrid)
- Effectively moves the player to the Grid specified.
- Parameters:
newGrid
- The Grid to move the player to.
getGrid
public Grid getGrid()
- Returns:
- The Grid that the player is on.
getInventory
public java.util.ArrayList<Item> getInventory()
- Returns:
- Player's inventory in an arrayList.