summaryrefslogtreecommitdiffstats
path: root/Map.gd
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-11 00:07:56 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-11 00:07:56 +0200
commit7fca7e65985deb24d51041d30fb8ea6ed2bd8571 (patch)
tree1c0b918d97b9122a9e1b091654bc5b441609e7c0 /Map.gd
parent35b1995824bbc3e35ed2488e4034cc6b47c2bc76 (diff)
downloadgodot-hexgrid-7fca7e65985deb24d51041d30fb8ea6ed2bd8571.zip
godot-hexgrid-7fca7e65985deb24d51041d30fb8ea6ed2bd8571.tar.gz
properly implement road march
Diffstat (limited to 'Map.gd')
-rw-r--r--Map.gd14
1 files changed, 13 insertions, 1 deletions
diff --git a/Map.gd b/Map.gd
index b1859d0..1eda9e8 100644
--- a/Map.gd
+++ b/Map.gd
@@ -43,12 +43,24 @@ func reset() -> void:
func get_tile(coords : Vector2, k : int) -> Tile:
if hexes.has(k): return hexes[k]
var hex : Hex = Hex.new()
+ hex.roads = get_road(k)
hex.rotation_degrees = hex_rotation
- hex.configure(board.center_of(coords), coords, [GREEN, BLACK, CITY, TREE, MOUNT, MOVE])
+ hex.configure(board.center_of(coords), coords, [GREEN, BLACK, CITY, TREE, MOUNT, BLOCK, MOVE])
hexes[k] = hex
$Hexes.add_child(hex)
return hex
+func get_road(k : int) -> int:
+ if not board.v: return 0
+ var v : int = 0
+ v += (HexBoard.Orientation.E if k in [19,20,21,23,24,42,43,44,45,46,47] else 0)
+ v += (HexBoard.Orientation.W if k in [19,20,21,22,24,25,43,44,45,46,47] else 0)
+ v += (HexBoard.Orientation.SE if k in [22,32,42,52,62] else 0)
+ v += (HexBoard.Orientation.NW if k in [32,42,52,62] else 0)
+ v += (HexBoard.Orientation.NE if k in [7,16,25,32] else 0)
+ v += (HexBoard.Orientation.SW if k in [7,16,23] else 0)
+ return v
+
func config(l : bool, m : bool) -> void:
show_los = l
show_move = m