summaryrefslogtreecommitdiffstats
path: root/Tile.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 /Tile.gd
downloadgodot-hexgrid-72174f8aa1d75707d8a9358c24771054da46b167.zip
godot-hexgrid-72174f8aa1d75707d8a9358c24771054da46b167.tar.gz
Initial commit
Diffstat (limited to 'Tile.gd')
-rw-r--r--Tile.gd36
1 files changed, 36 insertions, 0 deletions
diff --git a/Tile.gd b/Tile.gd
new file mode 100644
index 0000000..ec9b52c
--- /dev/null
+++ b/Tile.gd
@@ -0,0 +1,36 @@
+#warning-ignore-all:unused_argument
+extends Node2D
+
+class_name Tile, "res://godot/Tile.png"
+
+var coords : Vector2
+var blocked : bool
+var on_board : bool = false
+
+func configure(p : Vector2, c: Vector2, o :Array) -> void:
+ position = p
+ coords = c
+ on_board = true
+ for t in o:
+ var s :Sprite = Sprite.new()
+ s.texture = load(t)
+ s.visible = false
+ add_child(s)
+ visible = false
+
+func block_los(from : Tile, to : Tile, d : float, dt : float) -> bool:
+ return false
+
+func enable_overlay(i :int, v : bool) -> void:
+ get_child(i).visible = v
+ if v:
+ visible = true
+ else :
+ visible = false
+ for o in get_children():
+ if o.visible:
+ visible = true
+ break
+
+func is_overlay_on(i) -> bool:
+ return get_child(i).visible