summaryrefslogtreecommitdiffstats
path: root/Hex.gd
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-09 13:56:46 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-09 13:56:46 +0200
commit72174f8aa1d75707d8a9358c24771054da46b167 (patch)
tree9fcbf2e4cfa9b15bbea376cda0c4805304ad9c2f /Hex.gd
downloadgodot-hexgrid-72174f8aa1d75707d8a9358c24771054da46b167.zip
godot-hexgrid-72174f8aa1d75707d8a9358c24771054da46b167.tar.gz
Initial commit
Diffstat (limited to 'Hex.gd')
-rw-r--r--Hex.gd24
1 files changed, 24 insertions, 0 deletions
diff --git a/Hex.gd b/Hex.gd
new file mode 100644
index 0000000..f06c7bf
--- /dev/null
+++ b/Hex.gd
@@ -0,0 +1,24 @@
+#warning-ignore-all:unused_argument
+extends Tile
+
+class_name Hex, "res://godot/Tile.png"
+
+func inspect() -> String:
+ return "[%d;%d] %s" % [coords.x,coords.y,not blocked]
+
+func block(b : bool) -> void:
+ enable_overlay(0, b)
+
+func is_blocked() -> bool:
+ return is_overlay_on(0)
+
+func block_los(from : Tile, to : Tile, d : float, dt : float) -> bool:
+ return is_blocked()
+
+func show_los(b) -> void:
+ if not b:
+ enable_overlay(1, false)
+ enable_overlay(2, false)
+ else:
+ if blocked: enable_overlay(2, true)
+ else: enable_overlay(1, true)