aboutsummaryrefslogblamecommitdiffstats
path: root/Scripts/drawing.gd
blob: 34129ac6dabc23bc4f42b6fe486782b7530b577f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)