aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/drawing.gd
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Scripts/drawing.gd18
1 files changed, 18 insertions, 0 deletions
diff --git a/Scripts/drawing.gd b/Scripts/drawing.gd
new file mode 100644
index 0000000..34129ac
--- /dev/null
+++ b/Scripts/drawing.gd
@@ -0,0 +1,18 @@
+extends Node
+
+var drawing = false
+var line: Line2D
+
+
+func _ready():
+ line = $TrackLine
+ Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
+
+func _input(event):
+ if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
+ # start/stop drawing
+ drawing = event.pressed
+
+ if event is InputEventMouseMotion and drawing:
+ # extend the line
+ line.add_point(event.position)