This commit is contained in:
Yair Morgenstern
2021-04-01 20:44:49 +03:00
2 changed files with 11 additions and 3 deletions

View File

@ -443,9 +443,9 @@ open class TileInfo {
return when (tileMap.getNeighborTileClockPosition(this, otherTile)) {
2 -> otherTile.hasBottomLeftRiver // we're to the bottom-left of it
4 -> hasBottomRightRiver // we're to the top-right of it
4 -> hasBottomRightRiver // we're to the top-left of it
6 -> hasBottomRiver // we're directly above it
8 -> hasBottomLeftRiver // we're to the top-left of it
8 -> hasBottomLeftRiver // we're to the top-right of it
10 -> otherTile.hasBottomRightRiver // we're to the bottom-right of it
12 -> otherTile.hasBottomRiver // we're directly below it
else -> throw Exception("Should never call this function on a non-neighbor!")

View File

@ -581,7 +581,15 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
else ImageGetter.getImage(tileSetStrings.railroad)
roadImage.image = image
val relativeHexPosition = tileInfo.position.cpy().sub(neighbor.position)
val relativeHexPosition = when (tileInfo.tileMap.getNeighborTileClockPosition(neighbor, tileInfo)){
2 -> Vector2(0f,1f)
4 -> Vector2(-1f,0f)
6 -> Vector2(-1f,-1f)
8 -> Vector2(0f,-1f)
10 -> Vector2(1f,0f)
12 -> Vector2(1f,1f)
else -> Vector2.Zero
}
val relativeWorldPosition = HexMath.hex2WorldCoords(relativeHexPosition)
// This is some crazy voodoo magic so I'll explain.