Type "F" Board Map Glitch

From BOARD18 Project WIKI
Jump to: navigation, search

When creating the first type "F" Board Map (for 18EU) I came across the following glitch. The dropTile() function placed the tile in the wrong hex whenever I clicked on the lower half of the hex. The dropTile() function uses the hexCoord(xPix, yPix) method of the GameBoard Object to calculate the hex grid coordinates of the tile.

At first I suspected an error in this method. But the problem turned out to be more subtle than a mere error. The picture on the right shows the upper left corner of the original 18EU game board graphic. Note that every other column is a half a hex lower than the other columns. The hexCoord(xPix, yPix) method (as it is currently written) assumes that the first row is a higher row. In the original graphic it was a lower row.

At first I thought about fixing the method. But I couldn't think of an easy way to determine if the first row of the graphic was high or low. So I took the easy way out and decided that all type "F" Board Map graphics would be adjusted to work with the method as it was currently written. I did this by adding 87 pix of blank space to the left side of the image as is shown in the picture below. This simulated a "higher" first row and caused the hex calculations to be correct. Be careful not to add the 87 pix to the xStart parameter for the Game Board Image in the control file.