|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrogue.DungeonItem
public abstract class DungeonItem
Abstract base class for all items that may occur in the dungeon.
All items are characterised by a current position. They can be
removed from display map (vanish), or be added to the display map (show).
They can return their position, or be asked whether they are currently
at a particular location.
The read() function defined in this base class reads the starting position
as defined in the dungeon definition input file.
The link to the dungeon object is used to obtain access to the Map
structure when changing the visibility of the item.
ActiveItem,
Collectable| Field Summary | |
|---|---|
protected Pt |
myPosition
Protected element with current position. |
protected DungeonGame |
theDungeon
Link to dungeongame object |
| Constructor Summary | |
|---|---|
DungeonItem(int imageNo,
DungeonGame d)
Constructor - record image icon used and link to dungeon. |
|
| Method Summary | |
|---|---|
boolean |
isAt(Pt p)
Determine whether item at specified location |
Pt |
position()
Returns current position |
void |
read(java.io.BufferedReader in)
Gets initial starting point location for item from input file. |
void |
show()
Add item to display overlay map. |
void |
vanish()
Remove item from display overlay map |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Pt myPosition
protected DungeonGame theDungeon
| Constructor Detail |
|---|
public DungeonItem(int imageNo,
DungeonGame d)
imageNo - Integer identifier of icon used when displaying item.d - Link to dungeongame object.| Method Detail |
|---|
public void vanish()
public boolean isAt(Pt p)
p - Pt location used in query
public void show()
public void read(java.io.BufferedReader in)
in - BufferedReader connected to dungeon definition file.public Pt position()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||