|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmhframework.tilemap.MHMap
public class MHMap
Maintains data for a grid-based game map. This includes regular rectangular tile maps, isometric maps, and hexagonal maps.
Note that this class requires an existing class which implements the MHObjectVendor interface. The object vendor class is responsible for instantiating the dynamic actor objects in a map.
Also note that this class only maintains the data. The actual presentation of the map (scrolling, plotting, mouse mapping, etc.) is handled by subclasses of MHTileMap. If you are using a subclass of MHTileMap to handle your map presentation, then you do not need to explicitly instantiate an MHMap object because the MHTileMap base class takes care of that for you when you provide a map file name to the constructor.
The map data will be stored in five separate files:
Note: The file names given here are merely suggestions, and the code in this class does nothing to enforce any sort of naming conventions. It simply opens and reads whatever file names are supplied.
Constructor Summary | |
---|---|
MHMap(int mapHeight,
int mapWidth,
MHObjectFactory vendor)
Constructor that creates a map with the given number of rows and columns. |
|
MHMap(java.lang.String filename,
MHObjectFactory vendor)
Constructor that creates a map using the given map file name. |
Method Summary | |
---|---|
java.lang.String |
getCeilingFile()
Returns the ceilingFile. |
java.lang.String |
getDetailFile()
Returns the detailFile. |
java.lang.String |
getFloorFile()
Returns the floorFile. |
int |
getHeight()
Returns the number of rows in the map. |
java.lang.String |
getItemFile()
Returns the itemFile. |
MHMapCell |
getMapCell(int row,
int column)
Returns the map cell at the given coordinates |
static MHMapFileInfo |
getMapFileInfo()
|
java.lang.String |
getMapFileName()
Returns the fileName. |
int |
getTileSetId()
Returns the tileSetId. |
java.lang.String |
getWallFile()
Returns the wallFile. |
int |
getWidth()
Returns the number of columns in the map. |
void |
loadMapFile(java.lang.String filename)
Loads all the data files listed in the given file name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MHMap(int mapHeight, int mapWidth, MHObjectFactory vendor)
dataModel
- A reference to the application's data model.mapHeight
- The height of the game map in number of
cells.mapWidth
- The width of the game map in number of cells.public MHMap(java.lang.String filename, MHObjectFactory vendor)
filename
- The name of the map file to be loaded.Method Detail |
---|
public void loadMapFile(java.lang.String filename)
filename
- The name of the map file to be loaded.public MHMapCell getMapCell(int row, int column)
public int getHeight()
public int getWidth()
public java.lang.String getCeilingFile()
public java.lang.String getMapFileName()
public java.lang.String getFloorFile()
public java.lang.String getItemFile()
public java.lang.String getDetailFile()
public int getTileSetId()
public java.lang.String getWallFile()
public static MHMapFileInfo getMapFileInfo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |