25 lines
514 B
GDScript
25 lines
514 B
GDScript
extends Node2D
|
|
|
|
const Circle = preload("res://Circle.gd")
|
|
|
|
onready var circle: Circle = Circle.new()
|
|
export var color: Color = Color.red
|
|
|
|
var selected_idx = 0
|
|
|
|
func _ready():
|
|
update_circle()
|
|
for child in get_children():
|
|
if child is CanvasItem:
|
|
child.connect("moved", self, "update_circle")
|
|
|
|
func update_circle():
|
|
var ps = []
|
|
for child in get_children():
|
|
ps.append(child.position)
|
|
circle.circumscribe(ps)
|
|
update()
|
|
|
|
func _draw():
|
|
draw_arc(circle.position, circle.radius, 0, TAU, 200, color, 2.0, true)
|