godot-knot/game/objects/circle/circle.gd

30 lines
617 B
GDScript

extends Node2D
signal raised
var attached_lines = {}
# Called when the node enters the scene tree for the first time.
func _ready():
set_process_input(false)
func add_line(line, point_index):
attached_lines[line] = point_index
func _input(event):
if event is InputEventMouseMotion:
set_global_position(event.position)
move_lines()
func move_lines():
for line in attached_lines.keys():
line.set_point_position(attached_lines[line],self.position)
func _on_button_button_down():
#set_process(true)
set_process_input(true)
func _on_button_button_up():
emit_signal("raised")
set_process_input(false)