diff --git a/src/game/engine/src/map/hex_utils.gd b/src/game/engine/src/map/hex_utils.gd index 811e886d..b4d94949 100644 --- a/src/game/engine/src/map/hex_utils.gd +++ b/src/game/engine/src/map/hex_utils.gd @@ -14,13 +14,6 @@ extends RefCounted ## Odd columns shift down by height/2 = 166 -## Flat-top hex pixel dimensions — regular hexagon (all 6 neighbors adjacent) -const HEX_WIDTH: float = 384.0 -const HEX_HEIGHT: float = 332.0 # 384 × √3/2 ≈ 332 (regular hex) -const HEX_HORIZ_SPACING: float = 288.0 # 384 × 0.75 -const HEX_VERT_SPACING: float = 332.0 -const HEX_HALF_HEIGHT: float = 166.0 - ## Map topology — controls how units cross map boundaries. enum WrapMode { NONE = 0, ## Hard walls on all edges (flat map) @@ -28,6 +21,13 @@ enum WrapMode { SPHERE = 2, ## East-west wraps + polar reflection with 180° longitude shift } +## Flat-top hex pixel dimensions — regular hexagon (all 6 neighbors adjacent) +const HEX_WIDTH: float = 384.0 +const HEX_HEIGHT: float = 332.0 # 384 × √3/2 ≈ 332 (regular hex) +const HEX_HORIZ_SPACING: float = 288.0 # 384 × 0.75 +const HEX_VERT_SPACING: float = 332.0 +const HEX_HALF_HEIGHT: float = 166.0 + ## Axial direction vectors for flat-top hexes (6 neighbors) const AXIAL_DIRECTIONS: Array[Vector2i] = [ Vector2i(1, 0), # 0 = East @@ -227,7 +227,9 @@ static func is_in_bounds(axial: Vector2i, width: int, height: int) -> bool: ) -static func normalize_position(axial: Vector2i, width: int, height: int, wrap_mode: int) -> Vector2i: +static func normalize_position( + axial: Vector2i, width: int, height: int, wrap_mode: int +) -> Vector2i: ## Return the canonical axial position after applying map wrap topology. ## ## SPHERE: crossing a pole reflects row back from the edge and shifts column