-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLineTest.gd
More file actions
30 lines (24 loc) · 917 Bytes
/
Copy pathLineTest.gd
File metadata and controls
30 lines (24 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var cur_axis = null
# Called when the node enters the scene tree for the first time.
func _ready():
var size = get_viewport().size
$Line2D.set_line([Vector2(size.x / 2, 50), Vector2(size.x / 2, size.y - 50)], 2)
# $Line2D.set_line([Vector2(0, size.y / 2), Vector2(size.x, size.y / 2)], 1)
$Line2D2.set_line([Vector2(50, 50), Vector2(size.x / 2, size.y / 2)], 2)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("mouse_left"):
if $Line2D.is_select:
cur_axis = $Line2D
if $Line2D2.is_select:
cur_axis = $Line2D2
if Input.is_action_pressed("mouse_left") && cur_axis:
cur_axis.move_to(get_viewport().get_mouse_position())
if Input.is_action_just_released("mouse_left"):
cur_axis = null
pass