mhframework.tilemap
Class MHHexMap

java.lang.Object
  extended by mhframework.tilemap.MHTileMap
      extended by mhframework.tilemap.MHIsometricMap
          extended by mhframework.tilemap.MHHexMap
All Implemented Interfaces:
MHRenderable

public class MHHexMap
extends MHIsometricMap

Handles the presentation of a hexagonal tile map.


Field Summary
 
Fields inherited from class mhframework.tilemap.MHIsometricMap
cursorFlasher, cursorOn, mouseMap
 
Fields inherited from class mhframework.tilemap.MHTileMap
anchorSpace, cursorAddress, cursorAnchor, cursorPoint, DIR_EAST, DIR_NORTH, DIR_NORTHEAST, DIR_NORTHWEST, DIR_SOUTH, DIR_SOUTHEAST, DIR_SOUTHWEST, DIR_WEST, MAX_DIRECTIONS, screenAnchor, screenSpace, worldSpace
 
Constructor Summary
MHHexMap(java.lang.String filename, MHObjectFactory vendor)
           
 
Method Summary
 MHMapCellAddress mapMouse(java.awt.Point p)
          Converts a screen (mouse) coordinate into a map coordinate.
 java.awt.Point plotTile(int mapRow, int mapCol)
          Calculates the pixel position at which the input actor will be rendered.
 MHMapCellAddress tileWalk(int x, int y, int direction)
          Calculates the next map position to which an actor would walk if it were in position (row, column) and travelled in the direction specified by direction.
 
Methods inherited from class mhframework.tilemap.MHIsometricMap
advance, drawCursor, getTileHeight, isCursorOn, render, render, render, setCursorOn, tileWalk
 
Methods inherited from class mhframework.tilemap.MHTileMap
calculateAnchorSpace, calculateWorldSpace, clipCursorAddress, clipScreenAnchor, getCursorAddress, getCursorPoint, getMapData, getScreenAnchor, getScreenSpace, getTileWidth, isAnchorCoordinate, isScreenCoordinate, isWorldCoordinate, mouseMoved, screenToWorld, scrollMap, setCursorPoint, setScreenAnchor, setScreenAnchor, setScreenSpace, setTileWidth, worldToScreen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MHHexMap

public MHHexMap(java.lang.String filename,
                MHObjectFactory vendor)
Method Detail

tileWalk

public MHMapCellAddress tileWalk(int x,
                                 int y,
                                 int direction)
Description copied from class: MHIsometricMap
Calculates the next map position to which an actor would walk if it were in position (row, column) and travelled in the direction specified by direction.

Specified by:
tileWalk in class MHIsometricMap
Parameters:
x - The actor's current row position.
y - The actor's current column position.
direction - The direction in which to walk.
Returns:
A point indicating the actor's new column and row position after walking from its original position.

mapMouse

public MHMapCellAddress mapMouse(java.awt.Point p)
Description copied from class: MHIsometricMap
Converts a screen (mouse) coordinate into a map coordinate. Uses the five-step mouse mapping algorithm presented in the book Isometric Game Programming with DirectX 7.0 by Ernest Pazera.

Overrides:
mapMouse in class MHIsometricMap
Parameters:
p - A point representing a mouse coordinate.
Returns:
The address of the map cell containing the input mouse coordinate.

plotTile

public java.awt.Point plotTile(int mapRow,
                               int mapCol)
Description copied from class: MHIsometricMap
Calculates the pixel position at which the input actor will be rendered.

Specified by:
plotTile in class MHIsometricMap
Parameters:
mapRow - The row of the map containing the actor (tile) to be plotted.
mapCol - The column of the map containing the actor (tile) to be plotted.
Returns:
The pixel position at which the actor will be rendered.