aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts
diff options
context:
space:
mode:
authorLibravatar perivesta <>2023-07-08 16:13:25 +0200
committerLibravatar perivesta <>2023-07-08 16:13:25 +0200
commitd98cee8592e15f23ce85e8d54abb29aa341c97da (patch)
treef9b2301818438fa1903650f8c47c7464aae109db /Scripts
parent9573d3ae4170f43f7f65224a16db7ad161a11e28 (diff)
download2023-d98cee8592e15f23ce85e8d54abb29aa341c97da.tar.gz
2023-d98cee8592e15f23ce85e8d54abb29aa341c97da.tar.bz2
2023-d98cee8592e15f23ce85e8d54abb29aa341c97da.zip
start drawing when clicking on start. end at finish
Diffstat (limited to 'Scripts')
-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)
+