blob: 2e4af958954bd1c60547bb812b337f72e7c5994a (
plain) (
tree)
|
|
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 _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
line.add_point(event.position)
path.curve.add_point(event.position)
|