rogue
Class Player

java.lang.Object
  extended by rogue.DungeonItem
      extended by rogue.ActiveItem
          extended by rogue.Player

public class Player
extends ActiveItem

class Player An instance of this class acts as the user's "avatar" in the game. The data file must define a Player object and specify its initial position.


Field Summary
 
Fields inherited from class rogue.ActiveItem
myHealth
 
Fields inherited from class rogue.DungeonItem
myPosition, theDungeon
 
Constructor Summary
Player(DungeonGame d)
          Constructor It invokes super constructor (i.e.
 
Method Summary
 void getHit(int damage)
          Record wounding of Player by monster
 void read(java.io.BufferedReader input)
          Invokes super.read (ActiveItem) to read standard data such as location and health rating, then reads "strength" parameter of Player.
 void run()
          Defines run behaviour of Player - check for an input command (numeric key), if there is input, invoke the performMovementCommand() function.
 
Methods inherited from class rogue.ActiveItem
alive, move, step
 
Methods inherited from class rogue.DungeonItem
isAt, position, show, vanish
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player(DungeonGame d)
Constructor It invokes super constructor (i.e. ActiveItem constructor) passing as arguments details of the icon to be used, and the reference to the dungeon game object.

Parameters:
d - Reference to dungeon game object
Method Detail

read

public void read(java.io.BufferedReader input)
Invokes super.read (ActiveItem) to read standard data such as location and health rating, then reads "strength" parameter of Player.

Overrides:
read in class ActiveItem
Parameters:
input - BufferedReader connected to dungeon definition file

run

public void run()
Defines run behaviour of Player - check for an input command (numeric key), if there is input, invoke the performMovementCommand() function.


getHit

public void getHit(int damage)
Record wounding of Player by monster

Overrides:
getHit in class ActiveItem
Parameters:
damage - Amount of damage done by monster's attack