rogue
Class Monster
java.lang.Object
rogue.DungeonItem
rogue.ActiveItem
rogue.Monster
public abstract class Monster
- extends ActiveItem
Extends ActiveItem and acts as a base class for all monster classes.
This class should define the default characteristics shared by all Monster
classes.
It should define a "read" method if there are any data elements that all
monster classes would own; this would call super.read() (ActiveItem.read) to
read all properties shared by all ActiveItems (initial location, health etc)
then it should read lines with its own data.
If there are no data fields (apart from inherited location, health fields etc)
then there is no need to define read(). Subclasses invoking super.read will
use Monster.read() if it exists, otherwise will use ActiveItem.read().
The run() method should define the essential behaviour of a Monster in
terms of private auxiliary functions, e.g.
run
if can-attack then attack
else
if can-detect then advance
else
do-normal-behavior
The class would define the functions:
can-attack()
attack()
can-detect()
advance()
do-normal-behaviour()
These might be abstract, partially implemented, or have default implementations.
|
Constructor Summary |
Monster(int ImageNo,
DungeonGame d)
Constructor - would invoke super class constructor (passing arguments) and
perform any other standard initialization. |
|
Method Summary |
void |
run()
Define characteristic behaviour of monsters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Monster
public Monster(int ImageNo,
DungeonGame d)
- Constructor - would invoke super class constructor (passing arguments) and
perform any other standard initialization.
- Parameters:
ImageNo - Integer identifying image used to represent particular monster.d - Link to dungeon game object
run
public void run()
- Define characteristic behaviour of monsters.