aboutsummaryrefslogblamecommitdiffstats
path: root/Scripts/drawing.gd
blob: 51e7f21fbe2a295e86db0ad396262d9034698e01 (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                   
 

                                      

              

                                                      



                             
            
 












                                 
                   
                                                      
                                              
                                                    
 
extends Node

var drawing = false

@onready var line: Line2D = $TrackLine
@onready var path: Path2D = $TrackPath

func _ready():
	Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)

func _process(delta):
	pass

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 drawing and event is InputEventMouseMotion:
		line.add_point(event.position)
		path.curve.add_point(event.position)