diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-19 21:49:00 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-19 21:49:00 +0200 |
commit | 97629c24f4ba40ddbb1c2bc5ffd52ff74eea68b7 (patch) | |
tree | e82117567a41629604dcb12746d28442cd25e48b /Hex.gd | |
parent | dc4c8275bf7fe7b22783b5ed366e3eb9c0b83a5b (diff) | |
download | godot-hexgrid-97629c24f4ba40ddbb1c2bc5ffd52ff74eea68b7.zip godot-hexgrid-97629c24f4ba40ddbb1c2bc5ffd52ff74eea68b7.tar.gz |
implement Range Of Influence Demo
Diffstat (limited to 'Hex.gd')
-rw-r--r-- | Hex.gd | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -23,7 +23,7 @@ func has_road(o : int) -> bool: func change() -> void: type = (type + 2) % 5 - 1 for i in range(4): - enable_overlay(i + 2, i == type) + enable_overlay(i + 3, i == type) func cost() -> int: if type == -1: return 1 @@ -63,15 +63,18 @@ func block_los(from : Tile, to : Tile, d : float, dt : float) -> bool: return ((h * d / dt) >= to.elevation() - e) func show_los(b) -> void: - if b: enable_overlay((1 if blocked else 0), true) + if b: enable_overlay((2 if blocked else 1), true) else: - enable_overlay(0, false) enable_overlay(1, false) + enable_overlay(2, false) func show_move(b) -> void: - if 6 < get_child_count(): - enable_overlay(6, b) + enable_overlay(7, b) func show_short(b) -> void: - if 7 < get_child_count(): - enable_overlay(7, b) + enable_overlay(8, b) + +func show_influence(b) -> void: + var s : Sprite = get_child(0) + s.modulate = Color(f/10.0, 0, 0) + enable_overlay(0, b) |