aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/drawing.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/drawing.gd')
-rw-r--r--Scripts/drawing.gd28
1 files changed, 15 insertions, 13 deletions
diff --git a/Scripts/drawing.gd b/Scripts/drawing.gd
index 2e4af95..51e7f21 100644
--- a/Scripts/drawing.gd
+++ b/Scripts/drawing.gd
@@ -14,19 +14,21 @@ func _process(delta):
func _physics_process(delta):
pass
+
+func _start_drawing():
+ line.clear_points()
+ path.curve.clear_points()
+ drawing = true
+ owner.set_driving(false)
+
+
+func _end_drawing():
+ drawing = false
+ owner.set_driving(true)
+
+
func _input(event):
- if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
- drawing = event.pressed
- if drawing:
- # start a new drawing
- line.clear_points()
- path.curve.clear_points()
- owner.set_driving(false)
- else:
- # start driving
- owner.set_driving(true)
-
- if event is InputEventMouseMotion and drawing:
- # extend the line
+ if drawing and event is InputEventMouseMotion:
line.add_point(event.position)
path.curve.add_point(event.position)
+